I am writing a code in the header that pertains to link rel=’prev’ and link rel=’next’ thing but I need to check if the post is multipage. I check out these global variables:
$numpages
$multipage
However they don’t work in header.php or outside the loop? Example code to verify in header (just a test, but it does not work):
<?php
global $wp_query;
global $numpages;
global $multipage;
If ($multipage) {
echo 'This is a multipage post';
} else {
echo 'This is not multipage';
}
?>
I am wondering how to do this, can somebody help me please? Thanks.
Just inspect the current post content for
'<!--nextpage-->'
:On page 2 of 3 that returns:
On an unpaged post it returns: