How-to add pagination to WordPress posts

Let’s say you have a really long post. I mean a really really long post. And you want to break it up somewhere in the middle. Or into three or four pages. How do you do it with WordPress?

It’s fairly simple, and uses some built-in WordPress functionality that is hidden.

1. Add the “NextPage Buttons” plugin to get the button into your editor (or something similar, there may be others). It looks very similar to the “Insert More tag” button, but instead of inserting <!–more–> it inserts <!–next–>

2. Edit your single.php (or whatever it happens to be with your theme) and add this code right after:

<?php the_content(); ?>

so it looks like this:

<?php the_content(); ?>
<?php wp_link_pages(); ?>

That’s it! Now add the <!–next–> tag as many times as you want in your post and you will start to see pagination below your post.

For more information on styling the wp_link_pages() just visit this page.

You can test it out here:

No Replies to "How-to add pagination to WordPress posts"

    Leave a Reply

    Discover more from Chris Duke

    Subscribe now to keep reading and get access to the full archive.

    Continue reading