3

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.

5

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

global $multipage, $numpages, $page;
if( $multipage && $page == $numpages )
    echo 'last page';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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