Forums › Forums › Search & Filter Pro › pagination for filtered results
- This topic has 4 replies, 2 voices, and was last updated 5 years ago by Trevor.
-
Anonymous(Private) November 1, 2019 at 5:05 pm #225324
Hi Trevor,
Here’s the issue I have.
1. Go to homepage. Filter the results with some choice, e.g. “documentary” – the ajax results show. All good so far, url looks like this: https://slpstream.com/filter/?_sft_category=documentary&_sfm_duration=6+1006
2. Click on page 2 via the pagination at the bottom of the page, expecting to see more documentary results and on page 2 you see unfiltered results and the url looks like this: https://slpstream.com/page/2/
I’m going to reply again and mark it private with a login for you so you can look at the settings if you want to.
Thanks so much for your help.
Alice
Trevor(Private) November 4, 2019 at 8:03 am #225345I 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