Ready to get started?Download WordPress


[resolved] Find out the last part of a page/post (4 posts)

  1. freeriders
    Posted 4 years ago #


    I'm currently doing a template for a page

    the content of my page is splited in different page's parts with <!nextpage>, I'm using wp_link_pages to paginate/navigate within the page's parts.

    I try to find out when I'm on the last part from the page split, so that I can make appear a special text..

    in some other words, I try to find out how many parts exist so that I can know where I'm.

    I know the variable $page, this is fine to know in which part I'm currently but not if that's the last one

    I've deeply searched the codex, but I have not been very successful on this one..

    maybe one of you guys have some hints?

    thank you in advance



  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    (in the loop)
    the variable $numpages holds the number of split page parts;

    and the variable $page holds the number of the actual subpage.

    <?php if($numpages > 1) echo 'you are on subpage '.$page.' of '.$numpages.' subpages'; ?>

  3. freeriders
    Posted 4 years ago #

    Alchymyth you rock !!!!

    you saved my day, I was not aware of the numpage variable, you truly rock !!!

    Thank you again very very much

  4. L D
    Posted 4 years ago #

    Yes, thanks for the info! It really did help me! :D

Topic Closed

This topic has been closed to new replies.

About this Topic