How to Split a Post or Page into Many

How to mod your theme to make use of <!–nextpage–>.

To tell WordPress to make use of this code, you need to insert some additional code into “the loop” in two different places, usually in your theme’s page.php and single.php pages. Here’s the code: (please note that the quotes are not being rendered properly, DO NOT copy and paste this code, write it manually in your page.php file.)

<?php wp_link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>

I’m using the Structure theme by Justin Tadlock, here is a screen shot of where I’ve inserted the above code into the page.php file. I always put it right after the content.How to Break Posts and Pages into Many in WordPress

After adding this, I can now use the <!–nextpage–> Quicktag when writing a page to split it into multiple pages. Notice I said page and not post? If you want to break the “page” while writing a post, you will want to insert this into your single.php file as well.

In future posts, I’ll be adding more extensive examples of this features and how to display your pages list differently.

Has this been helpful to you? What’s you’re favorite little-known WordPress mod?

If you see fit, please share this post on StumbleUpon or your preferred social site.