Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

A client of mine reviews products on his site, and wants to display the review criteria and score on the last page of each posts. Typically, there are 3-5 pages per post, and I'm looking for a way to check if we're on the last page.

‹!--nextpage--› is used in the post to divide it into pages, and wp_link_pages on the front-end to display pagination links.

I've been able to find ways of checking if we're on page one, or not on page one, or on a specific page. But nothing for checking if we're on the very last page.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can find this info in the global vars $multipage, $numpages, and $page

global $multipage, $numpages, $page;
if( $multipage && $page == $numpages )
    echo 'last page';
share|improve this answer
    
That did it, thank you! –  Matt Brett Nov 7 '12 at 16:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.