Forums › Forums › Search & Filter Pro › Pagination Problems
Tagged: pagination
- This topic has 8 replies, 2 voices, and was last updated 8 years, 4 months ago by Trevor.
-
Anonymous(Private) July 18, 2016 at 7:14 am #51406
Hi,
I’ve seen this problem described many other times by many people, but despite trying everything suggested in each thread I can find on the topic, I am still having the issue. I’m supposed to be launching a site tomorrow evening EST, and this bug would probably hold our launch up, so it’s a big deal that I get this figured out quickly and I would really appreciate some help.
The issue is that when my pagination links are clicked, they return the user to page 1 of the results instead of the page that was clicked on, and indeed mousing over the pagination links, you can see they do not include any pagination in the URL.
I’m running Search & Filter Pro 2.1.2.
Here are the paramaters I’m running for my pagination:
‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ),
‘format’ => ‘?sf_paged=%#%’,
‘current’ => max( 1, $paged ),
‘total’ => $wp_query->max_num_pages,
‘prev_next’ => false,
‘type’ => ‘array’,
‘prev_next’ => TRUE,
‘prev_text’ => __(‘Previous’),
‘next_text’ => __(‘Next’),Here is my URL:
http://startalk-allstars.comThanks.
Trevor(Private) July 18, 2016 at 11:16 am #51417I do not see what is around that code (always put code posted here inside back ticks – code tags), but another one that I have seen working looks like this:
function searchPagination() { $big = 999999999; // need an unlikely integer global $paged; echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?sf_paged=%#%', 'current' => max( 1, $paged) )); }
Anonymous(Private) July 18, 2016 at 3:20 pm #51461Hi Trevor,
I saw this snippet in one of the other threads and I’d tried using pieces of it to no avail. This morning (my time) I went ahead and tried to use the entire function in your example as-is to see if that might help, but I still have the same problem–all pagination links point back to the first page. What else can I do to get pagination working? Thanks.
-Brian.
Anonymous(Private) July 18, 2016 at 4:57 pm #51488I rewrote it to use the pagination you pasted above. Here’s what it looked like before
function sf_pagination() { // As above, but with Search & Filter pagination global $wp_query; $big = 999999999; $pages = paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, $sf_paged ), 'total' => $wp_query->max_num_pages, 'prev_next' => false, 'type' => 'array', 'prev_next' => TRUE, 'prev_text' => __('Previous'), 'next_text' => __('Next'), ) ); if( is_array( $pages ) ) { $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); echo '<ul class="pagination">'; foreach ( $pages as $page ) { echo "<li>$page</li>"; } echo '</ul>'; } }
Anonymous(Private) July 18, 2016 at 4:59 pm #51489Sorry, scratch that, I had to re-write it and changed the wrong lines. This is correct.
function sf_pagination() { // As above, but with Search & Filter pagination global $wp_query; $big = 999999999; $pages = paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?sf_paged=%#%', 'current' => max( 1, $paged ), 'total' => $wp_query->max_num_pages, 'prev_next' => false, 'type' => 'array', 'prev_next' => TRUE, 'prev_text' => __('Previous'), 'next_text' => __('Next'), ) ); if( is_array( $pages ) ) { $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); echo '<ul class="pagination">'; foreach ( $pages as $page ) { echo "<li>$page</li>"; } echo '</ul>'; } }
-
AuthorPosts