Split long posts into multiple pages in WordPress

Filed as Features, Guides on June 14, 2007 6:56 am

Have you ever read an online article that was so long that it was split into several pages so you didn’t have to load one long page, and instead, you had several smaller pages, making it easier to digest? If you’re using WordPress as your blogging platform, this very same effect can be easily achieved!

This is a feature of WordPress that is not very well known, probably because blog posts are generally not meant to be as long as a New York Times article. Keep in mind that WordPress is not only used as a blogging platform, but it can also be used as a complete CMS for your website, so there may be times when you DO have articles that are long enough to require the use of pagination (pagination simply means “the numbering of the pages.”)

Other people may prefer to split up their one, long blog post into multiple posts instead. Whatever you choose to do, it’s entirely up to you; what I’m offering to you here is simply another option that you can use in the future.

In order to paginate your blog post, in the Write panel in your WordPress admin, switch to the Code view (if you are using the Visual view) and then enter the following code to wherever you want to break the post up into a new page. An example is also offered along with it:

...so John went to sleep.

<!--nextpage-->

The next day, he...

This will create a list of pages that make up that post, shown like this:

Page 1, 2, 3

And you’re all done!

Gary King is a professional freelance web developer, primarily using Ruby on Rails and PHP to create cool new websites. When he’s not trying to take over the world one blog at a time, you can find him mulling over his thoughts at King Gary.

Tags:

This post was written by
Gary King

You can visit the Author Archive for a short bio, more posts, and other information about the author.

Possibly Related Posts

Submissions & Subscriptions

Submit the post to Reddit, StumbleUpon, Digg, Del.icio.us or Blogosphere News.

Did you like it? Then subscribe to our RSS feed!

  1. By franky posted on June 14, 2007 at 7:08 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Gary, Lorelle is going to kill you! :D

  2. By charlie posted on June 14, 2007 at 7:45 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Haha, franky, I was just thinking exactly the same thing! I was even thinking this might be a post by Lorelle about the issue of splitting posts into pages from the title in my feed reader.

  3. By Everton posted on June 14, 2007 at 8:45 am
    Want an avatar? Get a gravatar! • You can link to this comment

    I’ve been doing this for a while now, but I’ve only recently realised that the additional pages aren’t displayed to feedreaders, and they don’t even know they are there - WP need to fix this

  4. By pelf posted on June 14, 2007 at 10:13 am
    Want an avatar? Get a gravatar! • You can link to this comment

    *giggles* at franky’s comment, LOL.

  5. By Nia posted on June 14, 2007 at 10:15 am
    Want an avatar? Get a gravatar! • You can link to this comment

    This is great. It means I can, keep all post content above the fold with this simple insertion…I’ll see what the results look like in the reader where I allow “full” feed.

    Presently I am monetizing my sidebars so in fact I may want people to read below the fold however this is a great tool.

    Thanks. I’ll use it and if I want people to read below the fold, for the monetization of the sidebar below the fold then I’ll just display two or three posts at a time on the front page. This is a very nice tool.

    I’m going to implement and post about int now. (now means 1-2 hours, if I”m not interrupted, of course)

  6. By J. Angelo Racoma posted on June 14, 2007 at 10:22 am
    Want an avatar? Get a gravatar! • You can link to this comment

    OMG Gary! What have you just done?

  7. By J. Angelo Racoma posted on June 14, 2007 at 10:25 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Nia, I prefer to use excerpts instead on the front page (or you can use the MORE function). This way, users have a cleaner view of the front page, and I get more page views on individual articles.

    I’m not really into pagination, though, for reasons of usability, and because my blog posts are usually not that long. In those rare instances of lengthy posting, I use headers (enclosed with header tags like <h3></h3>).

    Good, simple, tutorial, though. I think pagination does have a use–and that’s for the really long articles.

  8. By Nia posted on June 14, 2007 at 10:31 am
    Want an avatar? Get a gravatar! • You can link to this comment

    uh, oh…by inserting whre I wanted teh page break I ended up with a first page and no second page at all. Clearly I’m missing something (like a course on coding). So I’ll have to put this into my RSS Shareds until I have time to search for more guidance.

    I don’t think I have an subscribers so the fact that it’s not visible in a reader is a moot point actually. ;)

    Keeping my posts under 500 words is a goal but still I do have a few posts at several of my sites that are way way long.

    I’ll either go back and edit, split into separate posts or this technique you’ve introduced me to when I understand what was apparently not obvious to me the first go ’round.

    Thanks, all the best!

  9. By Chris posted on June 14, 2007 at 11:06 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Now, if more WP Theme designers were aware of this. Often times, they leave out the necessary Template Tags to make that actually work.

    WP Codex article: http://codex.wordpress.org/Styling_Page-Links

  10. By Nia posted on June 14, 2007 at 3:48 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Thank you Chris and J now I understand why the was simply loping off half of the post. My template, as it stands is a bit “handicapped” in the codex dept.

    I’ll look into using the “more” That feature would be a nice way to take people down the length of the page scanning the title, illustration and couple of paragraphs of 3 distinct posts in succession.

  11. By Gary King posted on June 14, 2007 at 3:57 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    I never use this method myself, but there ARE times when you’re building a website using WordPress as a CMS and you want to use this functionality. It’s something that’s not commonly known, so I just wanted to throw it out there.

  12. By J. Angelo Racoma posted on June 14, 2007 at 10:28 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Online magazines often use page breaking to split long articles. I agree that sites using WP as a CMS would find this useful. But am I right to assume that the code for displaying/supporting pagination is not present in most downloadable themes these days (meaning the user has to add them to either index or single post file)?

  13. By Gary King posted on June 14, 2007 at 11:13 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    I believe that pagination is built into the same function that outputs content, so as long as you can see post content, then pagination will work.

  14. By Elixir Web Solutions posted on June 15, 2007 at 1:22 am
    Want an avatar? Get a gravatar! • You can link to this comment

    ya , u r right .. i have seen in many article comes in sections or part 1,2 3.. and so on …And it is easy to read full article ..

    Thanks,
    Elixir Web Solutions
    Web Design Services from India

  15. By Chris posted on June 15, 2007 at 9:26 am
    Want an avatar? Get a gravatar! • You can link to this comment

    I believe that pagination is built into the same function that outputs content [...]

    Hi Gary - I’m afraid not. The link I left here yesterday, to the WP Codex, explains more.

  16. By Joe Clark posted on June 15, 2007 at 11:45 am
    Want an avatar? Get a gravatar! • You can link to this comment

    While this may indeed be a WordPress feature, your advice is nuts and is, frankly, anti-Web.

  17. By Gary King posted on June 15, 2007 at 1:09 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Joe, for the XHTML zealot, using <b> instead of <strong> is also madness in most cases. Even though that may be the case, there ARE indeed certain situations where one may still want to use <b> because they want to FORCE something to be in bold text (since <strong> only OPTIONALLY makes something bold). I like to think that this equally gives the author the option of using this, without forcing them to do so.

  18. By Nia posted on June 15, 2007 at 9:06 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Chris, the codex was very helpful. The “more” works for me just fine. Thanks for your help.

  19. By Vito Raliffe posted on July 14, 2007 at 3:03 am
    Want an avatar? Get a gravatar! • You can link to this comment

    This article saved my life =D One of my articles were so long that the page starting breaking up, so I looked for how to use multiple pages in Google and this was the first thing that popped up! Thanks!

  20. TrackbackFriday Fishwrap: June 15Split Long Posts Into Multiple Pages In WordPress [Linkosphere]How to Split Long Posts Into Multiple Pages « Sabahan.com

    Your words are your own, so be nice and helpful if you can. If this is the first time you're posting a comment, it might go into moderation. Don't worry, it's not lost, so there's no need to repost it! We accept clean XHTML in comments, but don't overdo it please.