Splitting up long posts in WordPress Single.php
I just wanted somewhere to record this, so that I don’t waste another 4 hours trying to find it again in the future and because soon there will be a new release of the theme I’m using and I’m going to have to re-update the theme files again once I install it.
The More tag doesn’t work in this theme, and several hours later, I’m all for giving up on finding a ‘cure’ for that one for at least, the next century, but I found a different work-around that will make-do in the meantime, which is to use the wordpress’s built-in shortcode:
[snippet id=”237″]
The result was to split the long post into multiple pages, and at the end of the post, was the following:
Pages 1 2
I wanted to change “Pages 1 2” to be words instead of numbers, so that at the end of the post, it would read:
“Click here to Continue Reading” on the bottom of long posts, and,
“Go Back to Previous Section” on the next pages.
To accomplish that, I had to change a theme files, in particular, the single.php file, although in my case, because I am using a custom theme with it’s own set of rules, it ended up being the (templates/content-single.php) that I had to adjust.
So basically, I changed my existing theme’s wp_link_pages, to a new one, in order to display “Click here to Continue Reading” on the bottom of long posts, and “Go Back to Previous Section” for the following pages.
Replaced this:
[snippet id=”234″]
With this:
[snippet id=”235″]
If you understand “Geek Speak” (I don’t), then this page might help you further: wp_link_pages
I implemented the nextpage tag on my WP Cleanup post if you want a demo of the final result.