I am trying to find a way to get the current page number of an article that has been splitted into several pages with the use of:
<!-- nextpage -->
There is an example that can be found here:
http://codex.wordpress.org/Conditional_Tags#Testing_for_paginated_Pages
But this doesn’t work for me â it always returns 0:
$paged = $wp_query->get( 'paged' );
echo $paged;
Any idea? Thank you!
For multi-page posts:
$page
global variable returns the current page of a multi-page post.$numpages
global variable returns the total number of pages in a multi-page post.For paginated archive index pages:
$paged
global variable returns the current page number of a paginated archive index.To use any of these variables, simply globalize them first:
There you go:
Tested with wp 3.2 with basic permalinks and custom.
Edit: Didn’t see Chip Bennett’s answer wich is smaller.