• Hi,
    I need to be able to have some code to insert into a page on my gallery in wp.

    I want it to display:

    Before and After Gallery: 1 of 49

    I currently have them sitting on separate pages, so when I add in more before and after pages, I want some code to get the total number of pages so that it updates on all the pages. i.e., if I added in 16 more to the above example, it would then read;

    Before and After Gallery: 1 or 65
    Before and After Gallery: 2 or 65
    Before and After Gallery: 3 or 65

    Does anyone know how to do this or a plugin that will achieve this?

    Thanks

    Greg

Viewing 2 replies - 1 through 2 (of 2 total)
  • try:

    $paged = (intval(get_query_var('paged')) ? intval(get_query_var('paged')) : 1 );
    
    $max_page = intval($wp_query->max_num_pages);
    
    echo 'Before and After Gallery: ' . $paged . ' of ' . $max_page;
    Thread Starter gtgart

    (@gtgart)

    Hi alchymyth

    Thanks for your suggestion, but…

    That would only just return 1 of the total pages of the site.

    Or am I misinterpreting your code?

    What I need is for some code to look for a total number of pages that:

    1. Have the code embedded on only a group of pages

    2. Return that number to the page

    ie. I have several different before and after galleries and other pages on the site.

    Thanks

    Greg

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom pagination Page 1 or …’ is closed to new replies.