Forums › Forums › Search & Filter Pro › pagination for filtered results
- This topic has 4 replies, 2 voices, and was last updated 5 years, 9 months ago by
Trevor.
-
Trevor(Private) November 4, 2019 at 8:03 am #225345
I can see a few things that might be an issue.
The first is that, in addtion to the Home Page Search (ID 369), the Taxonomy Page Filter (ID 1119) both have the same template (index.php) and both point to the same results page (slug is
filter
). They might conflict with each other.Looking at index.php, I can see that the pagination is outside the
if ( have_posts() ) : ?>
code block (lines 152-164). It is also outside the Ajax Container block<div id="gwd-content" class="cactus-sub-wrap">
(lines 148-167).Does the pagination work if Ajax is OFF (remember that those two forms may conflict, if one has Ajax ON and one has it switched OFF)?
What happens if you change the Ajax Container to
cactus-listing-wrap
?Anonymous(Private) November 4, 2019 at 2:25 pm #225390Hi Trevor,
Thanks again for your amazing support. I tried a few things and this is what worked:
“Looking at index.php, I can see that the pagination is outside the if ( have_posts() ) : ?> code block (lines 152-164). It is also outside the Ajax Container block <div id=”gwd-content” class=”cactus-sub-wrap”> (lines 148-167).”
I moved the pagination inside the if ( have_posts() ) : ?> code block. It works.
The only issue now which I am reaching out to the theme developer for help with is that I get double pagination on the home page (only the homepage) when the user has filtered for a taxonomy. I think the theme inserts pagination without it showing in the index.php file. I need to make that conditional somehow so it only shows if the user hasn’t filtered.
Thanks again.
Alice
Trevor(Private) November 4, 2019 at 2:28 pm #225392You could test for filtering like this, but you need to code it for the ID number of your form (replace 2611):
global $searchandfilter; $sf_current_query = $searchandfilter->get(2611)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { // do the theme pagination } else { // do not do theme pagination }
Maybe the else part is not needed in your case?
-
AuthorPosts