Forums › Forums › Search & Filter Pro › is_paged() function no longer works
- This topic has 5 replies, 2 voices, and was last updated 4 years, 2 months ago by Trevor.
Viewing 6 posts - 1 through 6 (of 6 total)
-
Anonymous(Private) August 18, 2020 at 2:47 am #256329
Amazing, this works perfectly, thank you!!
I’m using it to run a function to offset the number of posts on the first page, but only if the page is outputting the default/unfiltered loop. Is this the best way to check that?
global $searchandfilter; $filtered = $searchandfilter->get(1045)->current_query()->is_filtered(); if ( !is_admin() && $query->is_main_query() && is_home() && $filtered != 1 ) { ... }
Trevor(Private) August 18, 2020 at 6:45 am #256340The code we would normally recommend, so you may need to modify this, or may indeed have used this, is:
global $searchandfilter; $sf_current_query = $searchandfilter->get(1045)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { // the unfiltered posts output code here } else { // the current (filtered) posts output code here }
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)