Hi Robert. You are using the shortcode results method and that uses our basic results.php template. Did you try to edit this using the guide in the documentation?
You will need to edit the HTML/CSS classes/IDs and add/remove the content parts you need. If you have an example in your theme of what it is supposed to look like, that might help.
AnonymousInactive
I am trying to activate infinite scroll on my search results but it doesn’t appear to be doing anything.
I want the results to appear on the same page as the search and I am using the shortcode method to achieve this. I have ‘Load results using Ajax?’ and ‘Make searches bookmarkable?’ checked and I have selected ‘Infinite Scroll’ in the Ajax Pagination section. When I update there appears to be nothing changed and I can tell it’s not working because I have made some changes to the default ‘results.php’ template—those changes can still be seen. Am I correct in assuming that as soon as I select ‘Infinite Scroll’ from the settings that it should then start using the ‘results-infinite-scroll.php’ template? It’s not doing that. Is there anything I’m doing wrong or missing?
Hi Guy/Sally (?)
If you are using the Shortcode method which uses the results.php template, find the featured image part (on the standard template file this is at line 59) and see it is using the ‘small’ image size. Change this to ‘thumb’. See here, from this:
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
to this:
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("thumb");
echo '</p>';
}
If you followed the customization instructions for the results.php template file, you can edit this to change/remove elements, and their HTML and CSS classes/ID’s, and also add HTML and add other fields or data by adding WordPress PHP.
I have previously posts some examples of edited results.php files. This link is for a search to find these other examples:
https://support.searchandfilter.com/forums/search/Sample+Results+Template/
AnonymousInactive
IT WORKS!!!
Thank you so much! I edited some old links I had put in the widgets and forgot about when I changed the site to https.
Now the search is really perfect! Thanks a million!
If I may bother you again, I’m trying to edit the layout, now that the content is fine.
I’ve tried placing the results in a grid, but since I’m not familiar with php, I’ve tried with a plugin (Post Grid).
It actually looks very nice (https://www.fanheart3.com/allthesefeelings/), but unfortunately the grid appears only below the search form, when no search is made yet, and when I make a search the grid disappears and I have the same standard post layout.
To make the plugin work, I edited the results.php page of search and filter with the code the plugin gave me after I selected all the options: echo do_shortcode(“[post_grid id=’4505′]”); ?>
Of course if this is not the best way to make grid laoyout with search and filter, I can surely remove the plugin and I’ll follow your instructions.
Secondly, I’d like to have all the taxonomies displayed horizontally (as you can see we have many and the users need to scroll down a lot), possibly in ordered rows with the checkboxes all lined one below the other, if it’s possible.
I’ve tried searching the forum for similar posts, and I’ve tried using this method: https://support.searchandfilter.com/forums/topic/horizontal-layout/ but it didn’t work…
Could you please help me once again?
Thank you!
You would edit the results.php to add HTML structure (or change/remove it) and CSS markup, and add other fields/taxonomy.
I can help with this, if you are able to give me an idea/example of what you want.
AnonymousInactive
Hello,
I’d like to modify the results and I have done what you say on the support section:
___________
Create a folder in your theme folder called search-filter.
Copy the file wp-content\plugins\search-filter\templates\results.php from the templates folder in to the newly created folder in your theme – wp-content\themes\your-theme-name\search-filter\results.php
From now on, Search & Filter will load this version of the template instead of its own – so you can make any customisations that are necessary.
___________
The results have to be displayed here: http://lasirena.nutrirlavida.com/recipes
But how can I customize it now? Do I have to modify some files, in this case which ones?
Thank you so much
Hi Lisa
You can also let them search, but show them nothing (or a custom message) using this type of PHP code (change the number 1234
for the ID number of your search form and change the line echo '<div>Nothing to see here folks!</div>';
for whatever you want before the filter is used instead of the results – or remove for nothing at all):
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1234)->current_query();
if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
echo '<div>Nothing to see here folks!</div>';
} else {
// your theme template code here for the part that runs the loop, e.g. if ( $query->have_posts() ) .....
}
For example, if you were using the shortcode method. OK, if you have followed the documentation to make a copy of the results.php into a new folder called search-filter
in your child theme or theme folder, then replace the contents of that template file with this:
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link http://www.designsandcode.com/
* @copyright 2015 Designs & Code
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode - think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags -
*
* http://codex.wordpress.org/Template_Tags
*
*/
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1234)->current_query();
if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
echo '<div>Nothing to see here folks!</div>';
} else {
if ( $query->have_posts() )
{
?>
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
<div class="pagination">
<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists('wp_pagenavi'))
{
echo "<br />";
wp_pagenavi( array( 'query' => $query ) );
}
?>
</div>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div>
<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>
</div>
<hr />
<?php
}
?>
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
<div class="pagination">
<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists('wp_pagenavi'))
{
echo "<br />";
wp_pagenavi( array( 'query' => $query ) );
}
?>
</div>
<?php
}
else
{
echo "No Results Found";
}
}
?>
I just searched for Policy
and then on the results page selected Early Years Development
and it filtered the results. So I do not see the issue.
Not sure what you mean by the other bit about custom classes? Do you mean in the results.php code?