Forums › Forums › Search & Filter Pro › Pagination
Tagged: pagination
- This topic has 3 replies, 2 voices, and was last updated 9 years, 7 months ago by Ross.
-
Anonymous(Private) March 19, 2015 at 9:25 am #13678
Hi,
I’m looking to add in pagination with numbers of pages to the template file in my theme folder. When I try to add in the same one I’m using elsewhere is doesn’t seem to work and I’m wondering what I need to change in it to get it working.
<?php global $wp_query; $big = 999999999; // need an unlikely integer $translated = __( 'Page', 'mytextdomain' ); // Supply translatable string echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages, 'before_page_number' => '<span class="screen-reader-text">'.$translated.' </span>' ) ); ?>
Any help is much appreciated.
Ross Moderator(Private) March 19, 2015 at 11:22 am #13681Hey Jordan
If you are displaying your results “as archive” – then this behaves just like an archive template – so any problems you have with pagination will likely also be present in other areas of your site – or you could check
archive.php
to see how pagination is set up there.Saying that, this plugin supports the wp_page_navi plugin, which I guess has the numbering that you need?
Thanks
Anonymous(Private) March 19, 2015 at 11:46 am #13686Fantastic, I’ll try this plugin.
The archives are great to use, but with the way I’m needing the site to work the shortcodes seem more flexible for the end user. That way I can use a single template for the various pages that have to be generated and just have them place the shortcode in a custom field to generate a new listing.
Thanks again.
Ross Moderator(Private) March 19, 2015 at 11:53 am #13690Ah I see
You will find that with the shortcode method, it is creating a custom loop – which doesn’t work out of the box with most pagination, normally there are one or two additional steps to make pagination work with custom queries, but this depends on how you are implementing this.
The sample
results.php
template has the code in it for thewp_page_navi
plugin so if its enabled it should just display.Thanks
-
AuthorPosts