只需检查当前帖子内容\'<!--nextpage-->\'
:
function wpse_check_multi_page()
{
$num_pages = substr_count(
$GLOBALS[\'post\']->post_content,
\'<!--nextpage-->\'
) + 1;
$current_page = get_query_var( \'page\' );
return array ( $num_pages, $current_page );
}
第2页,共3页,返回:
Array
(
[0] => 3
[1] => 2
)
在未分页的帖子上返回:
Array
(
[0] => 1
[1] => 0
)