1 Unfollow this topic Split Posts into Multiple Pages

peppermi

Member
Messages
118
Reaction score
8
Points
18
Split article into multiple pages

Well WordPress provides some inbuilt functions which can be easily used to divide any new or existing WordPress post into multiple sub pages. The secret code which you have to insert in your WordPress post where you want the article to split is
Code:
<!--nextpage-->


When you are editing your WordPress post or writing a new one, simply insert this code in the ‘HTML editor view‘ wherever you want to split the post. Use this code as many times as you want and it will divide your post into that many pages.
WordPress theme support for page links

But remember that your WordPress theme must support the page links feature, otherwise implementing this next page code will not split your article into multiple pages and no page links will be displayed. In fact this will actually only display the first page of your article and there will be no other links to point to other pages in which you divided your article.
If you use a modern WordPress theme, then it should automatically display and support this page links feature. If you use a custom WordPress theme, or an older WordPress theme, then you would need to add some additional PHP code in your single.php file (which displays the single post) to support this feature.
PHP:
<?php wp_link_pages(); ?>

Remember to add this code below the code where the main content is published
PHP:
<?php the_content();?>


as this will display the page links below the article. This code will display all the default arguments and display links to the multiple pages you have created.
If you want to style these links, you can insert this code into div tags and then use any CSS styling you want.
PHP:
<?php wp_link_pages('before=<div id="stylelinks">&after=</div>'); ?>
Well that’s it, which articles are you going to split up now?

Off our Tutorial Site
 
Top