AnonymousInactive
Hey Ross,
same results, even when using the standard results.php, having only WooCommerce, ACF and Search and Filter activated, using hard-coded shortcode and using vanilla wordpress/storefront themes… It usually works fine until cache rebuild hits about 2500 of the mentioned 4000 products. Then suddenly it says no results found. Really weird, we’ve invested a lot of time into the issue and hope we can somehow get it fixed.
If you have any input, idea, whatsoever, we’d be really thankful!
Sebastian
Hey Benoit
Try the following:
1)
Change the results container to:
#portfolio-grid
2)
Lets make a new template only for S&F results, because we want to make some customisations and not affect the rest of the site…
So duplicate the file page-Portfolio3Cols-filterable.php and rename this to search-filter-results.php
Then, via email, can you send me this file?
Thanks
Hi Jeff
I did a quick test as I hadn’t personally used that WP function before.
If you are using the shortcode method for displaying results, then edit your results.php template and on line 52, after the $query->the_post() add it there.. so the start of your while loop should look like:
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<?php echo get_post_mime_type(get_the_ID()); ?>
Notice I also added get_the_ID() which is sometimes not necessary but a good way to it.
Now you can access what file type they are 🙂
Thanks
How are you using results.php?
Can you send me a link to the page?
Thanks
AnonymousInactive
Fatal error: Call to a member function have_posts() on a non-object
How can i resolve this.
This is showing in results.php
AnonymousInactive
hi ross,
i don’t think so, because i copied the loop-single-topic.php into results.php and this is what i get.
any ideas what can be wrong?.
another thing is that after getting the results the search form stops working.
AnonymousInactive
hmmmm ok & SORRY! I think there was something wrong with the results.php …. deleted everything and now it seems to word again.
AnonymousInactive
Ok one more thing i found out. It just happens when i create a search-filter folder in my theme directory where i put the results.php in ….
Hey Travis are you using the shortcode method to display results? (hence using the results.php)? Then in this case, you will notice that they actually pass the custom query to the pagination function(s).
Therefor you need to use the pagination variable too:
So
'current' => max(1, get_query_var('paged')),
Should become something like:
'current' => max( 1, $query->query['paged'] ),
So the paged var inside the custom query (the shortcode method) is used rather than the global var.
Thanks
AnonymousInactive
Hello,
I’m running into an issue with pagination on the results page. The “next_posts_link()” and “previous_posts_link()” pagination that comes with the default results.php file works, but it doesn’t seem to work when I try to use the paginate_links() function. When the page is initially loaded, the pagination links work. For example, the links’ href are “?sf_paged=2” and so on. But, when I click on a page link in the pagination and the new page loads, the pagination links no longer work. they now all have hrefs as “?sf_action=get_results” and don’t link anywhere. Pagination links also won’t work when a filter is chosen. all the pagination links become “?sf_action=get_results&_sft_classification=oversight-and-development” or whatever the chosen filter is.
For reference, here is the pagination code I’m using:
<?php
global $wp_query;
$big = 999999999;
if ($query->max_num_pages > 1) {
echo '<div class="pagination">';
echo paginate_links(array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $query->max_num_pages,
'prev_text' => __('< PREV'),
'next_text' => __('NEXT >'),
));
echo '</div>';
}
Thank you for your help.
Travis