Last active
June 18, 2016 06:11
-
-
Save sudar/7e7d8988201775d53103bffb34dad039 to your computer and use it in GitHub Desktop.
How to find if you are on the last page of a multi-page post in WordPress. Explanation at http://sudarmuthu.com/blog/how-to-find-if-you-are-on-the-last-page-of-a-multi-page-post-in-wordpress/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Is the current page the last page of the multi-page post. | |
* | |
* @return bool True if last page, False otherwise. | |
*/ | |
function is_last_page() { | |
global $page, $numpages, $multipage; | |
if ( $multipage ) { | |
if ( $page != $numpages ) { | |
return false; | |
} else { | |
return true; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment