How to get the number of Pages in a single Post Pagination?
Inside the loop, as michael pointed out you could just refer to $numpages global variable. Outside of the loop, your code is almost fine. Being the number of the pages the number of <!–nextpage–> + 1, you could save a function call by doing: $numOfPages = 1 + substr_count($the_post->post_content, ‘<!–nextpage–>’); As a quick and not-that-dirty … Read more