• Resolved paa1605

    (@paa1605)


    Hi folks,

    i would like my category archive pages to show the current page number, for example..

    Page 2 of 6

    Does anyone know how to achieve this without a plugin?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • possibly with:

    <?php if( get_query_var('paged') ) : ?>
    Page <?php echo intval(get_query_var('paged')); ?> of <?php echo  intval($wp_query->max_num_pages);
    endif; ?>
    Thread Starter paa1605

    (@paa1605)

    Thanks for the reply.

    This doesn’t seem to work. Im very new on pagination and i currently use the <?php previous_posts_link(‘Previous’) ?> and <?php next_posts_link(‘Next’,”) ?> code to let users change page. The code that queries the posts and outputs them is <?php $posts = query_posts($query_string . ‘&orderby=date&order=DESC’); ?>. There is no mention of ‘paged’ in the arguments or query so maybe that is the reason why it didn’t work.

    Thanks for your help though.

    Im very new on pagination

    the code does not do pagination, it should do what you asked for: ‘show the current page number’

    the effect of the code could depend on the location where you add it;

    can you paste the full code including the added bit into a https://pastebin.com/ and post the link to it here?

    link to your site?

    ps:
    consider a plugin such as wp-pagenavi https://www.ads-software.com/extend/plugins/wp-pagenavi/

    Thread Starter paa1605

    (@paa1605)

    Got it working with the plugin you suggested! Thanks a lot for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to display current page number on category archives?’ is closed to new replies.