What function can I use to fetch content of a single page within a post?
Let’s say I want to split my post into 5 pages – how can I get content of, say, page 3?
Can’t seem to find this in Codex…
What function can I use to fetch content of a single page within a post?
Let’s say I want to split my post into 5 pages – how can I get content of, say, page 3?
Can’t seem to find this in Codex…
You must be logged in to post a comment.
This should do the trick:
Usage:
You should first explode the content, and then perform a few functions on the content to enable WordPress’ “Auto paragraph” formatting and Shortcodes.
Now you can echo each page like so:
You can also implement this feature/concept a tad differently. I like to split my post into two pages to give my copywriter the ability to create the main content and sidebar content. I basically assign the second page to the sidebar. While you could use the same code as above, a cleaner (yet less flexible way) might be to do something like this…
Now I can just echo out either the
$main_content
or$sidebar_content
variable wherever I want in my page template.