I want to split the the_content()
function in Wordpress where <!--nextpage-->
and store it into array, I am trying to achieve this without using plugin.
Rather than use the_content()
(that would print the content directly on the page), you can use get_the_content()
and then split it from there:
$parts = explode('<!--nextpage-->', get_the_content());
Just use the function get_the_content
(the content will echo it, get_ functions will not) and explode it like this:
$content = get_the_content();
list($page, $nextpage) = explode('<!--nextpage-->', $content);
// or when $content has more than one "<!--nextpage-->"
$pages = explode('<!--nextpage-->', $content);