-
AuthorSearch Results
-
November 10, 2020 at 12:48 pm #265799
In reply to: Search Result Display
TrevorParticipantAs you are using our shortcode method the display of 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
To change the image size, edit these lines:
<?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?>
I would suggest changing small to thumb.
You can change/delete other lines or parts. For example, to remove the date, you would need to remove this line:
<p><small><?php the_date(); ?></small></p>
November 10, 2020 at 9:42 am #265739In reply to: Pagination
TrevorParticipantI see that you are using our Shortcode method …
… in which case you should follow the ‘guide to customising’:
Once you have a copy of the
results.php
file in a search-filter sub-folder of your theme, you can edit that file, like this (leave the PHP comments at the top outside and before this code):global $searchandfilter; $sf_current_query = $searchandfilter->get(11690)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { // the current resuts.php code here }
This code will prevent any results from showing UNTIL a search has been made. If you need to modify it a little, at least it should give you some ideas.
You can show ALL results (no pagination) if you set in the form on the General settings tab the ‘Results per page’ to
-1
.The you need to remove the pagination output from the results.php code, so delete the two blocks that look like this (one before the loop, one after):
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>
November 9, 2020 at 1:55 pm #265638In reply to: search results appears before chcecking form
TrevorParticipantSo, using our Shortcode method …
… in which case you should follow the ‘guide to customising’:
Once you have a copy of the
results.php
file in a search-filter sub-folder of your theme, you can edit that file, like this (leave the PHP comments at the top outside and before this code):global $searchandfilter; $sf_current_query = $searchandfilter->get(8702)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { // the current resuts.php code here }
October 29, 2020 at 4:48 pm #264582In reply to: Customize default results with shortcode
AnonymousInactiveYes i made my own template for the results.php that i put in my-theme/search-filter as explained in this page https://searchandfilter.com/documentation/search-results/using-a-shortcode/
I just disabled Ajax, as you can see, the page reloads at each search but the custom template is not loaded at all.
October 29, 2020 at 4:34 pm #264574In reply to: Customize default results with shortcode
TrevorParticipantIt appears the you have modified the results.php to match your theme, and that is OK to do. But, I think Ajax is not refreshing the page correctly because of this. Can you test with Ajax disabled?
October 29, 2020 at 3:25 pm #264565In reply to: Infinite Scroll
TrevorParticipantAh, I think I see the problem now.
In the Search & Filter -plugin folder, in the subfolder named
templates
, are two files. Normal pagination template is results.php, and there is another for infinite scroll, with a similar but different structure.Which one did you use?
Whichever one you used, you need to follow our guide when doing that:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
The file must be renamed to either results.php or {the number of the form ID}.php
October 29, 2020 at 1:22 am #264494Topic: Customize default results with shortcode
in forum Search & Filter Pro
AnonymousInactiveHi,
I use your great plugin with the shortcode method.
I need to customize my results so i add my results.php file in my child theme and it works, except for the default results which appear before the firest search when i load my page.
Once i click on the search button, the results are shown as i want them to.Is there some option i missed somewhere to make it works?
Thank you very much and have a nice day.
LeslieOctober 28, 2020 at 4:49 pm #264461In reply to: Infinite Scroll
TrevorParticipantCan you share with me the content of the results.php template file you are using (you can remove the many comment lines)? Please post any code inside code ticks (one before the code, one after)? On my UK Windows keyboard, the code tick key is next to the 1 key in the standard part of the keyboard. If you do this Google search and look at the images, they show various keyboards and where the key is located:
October 22, 2020 at 9:25 pm #263788In reply to: search results conflict with brizy template
AnonymousInactiveI prepared the website so that it’s showing search results using shortcode – please do simply a new search.
To do this I had to embed a shortcode-element in brizy-template.
Changing line 60 of results.php to ‘the_content’ has the effect that it seems to run brizy loop as the first result and then repeating empty results – and the players are not shown at all.I will keep you up to date with what brizy support will say.
Thanks again for your time and your investigation!October 22, 2020 at 1:55 pm #263740In reply to: search results conflict with brizy template
TrevorParticipantWhen asking Brizy, what would be useful is if the have a hook where you can add an extra custom argument to the wp_query().
Are you able to show me a page using our shortcode method where you have changed the results.php template? What you suggest should work, but it depends how you implemented it on the page. Is it the Brizy loop content that repeats for each post? If so, then I can guess how that is happening, and that will not work, as it is their loop inside our loop.
-
AuthorSearch Results
-
Search Results
-
Hi,
I use your great plugin with the shortcode method.
I need to customize my results so i add my results.php file in my child theme and it works, except for the default results which appear before the firest search when i load my page.
Once i click on the search button, the results are shown as i want them to.Is there some option i missed somewhere to make it works?
Thank you very much and have a nice day.
Leslie