-
AuthorSearch Results
-
February 6, 2019 at 8:46 am #201353
AnonymousInactiveJust an update for issue 3, I muddled my way through copying that results.php template. I’ve managed to make most of the changes I wanted to achieve. The results now only show the image (yay!) but you can’t click them haha.
Are you able to tell me how I would make the thumbnails clickable through to their respective posts? I tried and I broke it…
Also, would you know how to make it into 3 columns (that reduce to two, then one, when the window gets smaller) instead of one giant image after another vertically?
My PHP code is below.
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link https://searchandfilter.com * @copyright 2018 Search & Filter * * 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 * */ if ( $query->have_posts() ) { ?> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> </div> <?php } ?> <?php } else { echo "No Results Found"; } ?>
February 6, 2019 at 8:08 am #201347In reply to: Current menu item
TrevorParticipantYes, that is totally possible. You need to edit the results.php template file you are using, like this:
global $searchandfilter; $sf_current_query = $searchandfilter->get(36613)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { // your current results.php code here }
February 4, 2019 at 12:35 pm #201097In reply to: results display with shortcode and tempalte
TrevorParticipantPossibly. Our shortcode method uses a default template called results.php, as detailed in this page:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
You are able to customize this (see the above documentation) and compare our template to the archive.php template you are using. The basic structure of our results.php file looks like this (pretty much standard structure for a WordPress archive template file):
<?php if ( $query->have_posts() ) { // do anything here that will appear before the actual posts, like pagination,number of results, etc. while ($query->have_posts()) { $query->the_post(); // output each post with whatever HTML and content you need } // do anything here that will appear before the actual posts, like pagination,number of results, etc. } else { echo "No Results Found"; } ?>
You would need to match up what is inside your template and copy and past, and it should work.
February 1, 2019 at 10:44 am #200885Topic: Results and filter not showing (using shortcode)
in forum Search & Filter Pro
AnonymousInactiveHi,
I’m using the filter and results shortcode on the same page (homepage);
https://gloryquotes.com/
The results don’t show after I rebuilt the cache. But there are like a 100k posts (custom post types), is that the reason? I do use a custom ‘results.php’ page. But that worked fine with fewer posts.
It does show results and filter while it’s rebuilding the cache, but when it’s done, the page is blank.Thanks!
January 29, 2019 at 11:00 pm #200548In reply to: Display number of posts in search results
AnonymousInactiveI am using a Post Type Archive within Beaver Themer. I found the results.php template, but am unsure what to do next?
January 29, 2019 at 11:32 am #200433In reply to: Display number of posts in search results
TrevorParticipantWhat Display Result method are you using? It IS possible, but you need to be done in the template being used for the results. That might be buried so deep in code it would be impractical to do though.
It is implemented in our Shortccde display results method, and you can see an example of the code if you look in the folder our plugin is in on your server, inside a templates folder and see the results.php template.
January 28, 2019 at 4:39 pm #200212In reply to: Show all results override settings in filter
TrevorParticipantOK. I have looked at the code. I can see when (not critical to this question) code errror, on line 217:
<li><i class="fas fa-users"></i>Activiteit</i></li>
This should be:
<li><i class="fas fa-users"></i>Activiteit</li>
What I would do is to have 2 results.php templates. Name them after the ID number of the form. So, the current form is 207. Let us say that the new form is ID 1234.
We will use the current form as is, and the new form is a duplicate of the form 207, except that the post per page is set to
-1
and Ajax is OFF.Place the code for the map into 1234.php
leaving only the code for the results in 207.php. Before that code, place a do_shortcode for the new form’s shortcode (outside the infinite scroll container).
<?php do_shortcode(‘[searchandfilter id=”1234″]’);`
Does that make sense?
January 28, 2019 at 1:07 pm #200130In reply to: Show all results override settings in filter
TrevorParticipantHow did you get the map to work?
Are you able to make the results.php template file available to me (from a file sharing site maybe)?
I suspect that what you want may be difficult to achieve. As it is, the map is very slow to load.
January 28, 2019 at 12:52 pm #200124
TrevorParticipantHi
This is an alternative exemplar results.php file content that might do as you want:
<?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 * */ 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 { //figure out which type of "no results" message to show $message = "noresults"; if(isset($query->query['paged'])) { if($query->query['paged']>1){ $message = "endofresults"; } } if($message=="noresults") { ?> <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'> <span>No Results Found</span> </div> <?php } else { ?> <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'> <span>End of Results</span> </div> <?php } } ?>
January 28, 2019 at 11:49 am #200092In reply to: Pagination does not seem to be working
TrevorParticipantThe URL above is not made by our plugin. The search on that page obviously is, but when the search suggested is made, the URL does not change.
I can see our javascript file being loaded, and there are no errors.
I can see that you are using v2.4.0 of our plugin, which is quite old (we are currently on 2.4.6), but you may need to upgrade it manually as we have changed domains and the version you have may be looking for updates on the wrong server.
Once you have updated, can you create a test search page, using a standard results.php file, to see if that works. You may need to give the results.php file the name of the form ID to stop it conflicting with the current setup. So, if the test form is ID 44000, name the file 44000.php
-
AuthorSearch Results
-
Search Results
-
Hi,
I’m using the filter and results shortcode on the same page (homepage);
https://gloryquotes.com/
The results don’t show after I rebuilt the cache. But there are like a 100k posts (custom post types), is that the reason? I do use a custom ‘results.php’ page. But that worked fine with fewer posts.
It does show results and filter while it’s rebuilding the cache, but when it’s done, the page is blank.Thanks!