The $multipage
is constructed inside the setup_postdata()
method of WP_Query
.
It’s called when you run the_post()
. So just as @s_ha_dum explained, you have to make a loop around it:
You can try this:
if( have_posts() )
{
the_post(); // Make a call to setup_postdata().
echo sbwp_get_current_chapter(); // Display the current chapter.
rewind_posts(); // Rewind back.
}
before your main loop, where you must remember to rewind back.