Forums › Forums › Search & Filter Pro › Numbered Paging
Tagged: numbered paging, paging
- This topic has 2 replies, 2 voices, and was last updated 9 years, 7 months ago by
Anonymous.
-
Anonymous(Private) June 1, 2016 at 6:56 pm #47245
Hi, I was wondering if your plugin works with numbered paging as well as standard ‘Next’/’Previous’ buttons built into the default template?
I spotted you have it working on the WooCommerce demo but I am having trouble making it work on my site.
I have used the following paginate_links() code to generate my page numbers…
<nav class="pagination numbered-paging"> <?php $args = array( 'total' => $query->max_num_pages, 'end_size' => 2, 'mid_size' => 2, 'prev_next' => true, 'prev_text' => __('Prev'), 'next_text' => __('Next') ); echo paginate_links( $args ); ?> </nav>…which with 10 pages shows 1 (with ‘current’ class),2,3 … 9, 10, Next as expected. Clicking any of the page numbered links loads that page of results but the ‘current’ page always stays as 1. Even clicking the ‘next’ button always goes to page 2 regardless of which page you are on.
And the ‘Prev’ button never appears as it always thinks you are on page one.
In my form settings, my Pagination Selector is set to ‘pagination a’ (which I think was the default if I remember correctly).
If you are able to advise if numbered pagination is possible that would be much appreciated. I can send you a private reply with a link to a dev server if that helps.
Thanks,
Paul
Anonymous(Private) June 2, 2016 at 4:30 pm #47316Hi Trevor, thanks very much for the quick response.
I figured out what was going on. the WordPress paginate_links(); function has an attribute for ‘current’ which defaults to 1. Changing the active page did not update this value so regardless of which page you were viewing the pagination always assumes you are on page 1.
So I took the…
$query->query['paged'];…that the template uses to display the current page number and fed that into the ‘current’ attribute so it now updates dynamically when the page changes.
Thanks,
Paul
-
AuthorPosts