It appears as though your are using the Shortcode Display Results Method. It looks like you are using a modified version of the results.php file.
The content you see comes from that file. It is calling up the content probably from the WordPress the_content()
function, over which we have no control. What you could do is to show/reveal the Excerpt meta box in the editor and create a custom excerpt for it to use instead.
AnonymousInactive
I tried both but it wasn’t working. I now copied the page navigation from results.php file in the plugin templates folder and it’s getting somewhere, thanks!
It shows the correct number of pages and links to older/newer posts. But there’s no page numbers so the user can navigate to page 5 for example. Now they have to click 5 times on the older posts link to go to page 5.
I see you are directly adding pagenavi. Why not put the standard WP pagination in there with Pagenavi off for now? You can see an example of this (and pagenavi integration), in the results.php file in our plugin templates folder.
You are using our shortcode method so displaying the results comes from our results.php file. You would need to customise it as described (in basic form) here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
You need to remove the line:
<p><br /><?php the_excerpt(); ?></p>
AnonymousInactive
Hi there. I´m getting well a variable ($textobt) in results.php loop, but when I apply a filter or I when I get more results when scroll the page, I can’t ge the variable.
This is my code
<div class="search-filter-results-list">
<div class="row">
<?php $textobt = get_field('texto_boton'); ?>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<article class="search-filter-result-item col-xs-6 col-sm-3 col-lg-2 item-n">
<div class="item-espectaculo">
<?php the_post_thumbnail('thumbnail', array('class' => 'item-img'), [ 'alt' => esc_html ( get_the_title() ) ]);?>
<div class="item-container">
<div class="ciudad"><img />/images/icon-position.png" height="13" class="icon-pos"><?php the_field('ciudad'); ?></div>
<h1><?php the_title(); ?></h1>
<div class="item-fechas"><?php the_field('desde'); ?> - <?php the_field('hasta'); ?></div>
<div class="sep-info"></div>
<!-- <div class="item-preciodesde">Desde <span class="carga-precio">0</span>€</div> -->
<button type="submit" onclick="window.location.href = '<?php the_field('url_espectaculo'); ?>';" class="btn btn-primary btn-lg btn-block bt-item"><?php echo $textobt; ?></button>
</div>
</div>
</article>
<?php
}
?>
</div>
</div>
And this is my site: https://eventos.entradas.com/
Thanks.
Is the form set to use the Shortcode Display Results method? If it is, then the results.php template file would need a different structure if you want to use pagination and not infinite scroll. You can see examples in our plugin templates sub-folder. The results.php contained there (these files should not be edited) has the pagination type code, and there is an infinite scroll version, with contents as you would expect.
We do not offer a Load More button, yet (probably coming in V3).
The second of the files you have shown is missing the complete structure that it should have, here is what the default infinite scroll template looks like (without the comments section at the top):
<?php
if ( $query->have_posts() )
{
?>
Found <?php echo $query->found_posts; ?> Results<br />
<div class='search-filter-results-list'>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class='search-filter-result-item'>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><br /><?php the_excerpt(); ?></p>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><?php the_category(); ?></p>
<p><?php the_tags(); ?></p>
<p><small><?php the_date(); ?></small></p>
<hr />
</div>
<?php
}
?>
</div>
<?php
}
else
{
?>
<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
<span>End of Results</span>
</div>
<?php
}
?>
Your code is missing this line:
<div class='search-filter-results-list'>
and the closing </div>
You need to rename the file to results.php, and the folder must not have pro on the end.
Hi
Are you using our Shortcode Display Results method?
Does your theme use a fairly standard PHP template to display the results (the PHP would have an IF have posts condition, with a while loop inside to step through the posts.
You can edit your own copy of our results.php file, as detailed here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
AnonymousInactive
Hi Trevor,
To recap, I’m using Display Results Method = Custom, and I have added a search (i.e., free text) field in my search form. I’m using the Post Grid plugin to display the results in grid format. What I’d like to do is add a line above the search results grid that says “You searched for: <search query term>”. Can you tell me how I would do this? I assume I would need to edit a php template some place, but I don’t think it’s the results.php based on the contents in the template. I could be wrong. If there’s a prior post that explains this, a link to it would be great. I wasn’t able to find this specific scenario in a forum search.
Thanks!
Please note that we are now into a holiday period in the UK. We will be working for some of this period, but replies may be delayed at times.
You are using our shortcode method so displaying the results comes from our results.php file. You would need to customise it as describe (in basic form) here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
Then you would need to look at your theme template that normally provides you with an archive page and hop that it follows a similar structure. If you look in our exemplar results.php file, the actuall output of the results is controlled in this form:
if ( $query->have_posts() )
{
while ($query->have_posts())
{
Do STUFF here to output the posts
}
} else {
Do STUFF here to show something if no posts are found
}
You can grab code from your theme template to place in those bits I marked. Without being able to see and work with the actual site, it is very hard to assist you.