Wordpress

Paginate WordPress Post – Breaking Posts Into Parts

Wordpress-Post-Navigation
Written by Wamiq Ali

In most of the blogs you might have seen posts are better organized by just making them paginated. This is a very good way to get more views on a single type of the wordpress post which is actually broken into many parts. The good thing is that you can paginate any post in wordpress by using this approach. This is not much hard to implement and things once done right can serve you a lot more page views so let’s paginate wordpress post.

Wordpress-Post-Navigation

Paginating the WordPress post in Editor:

Go to your wordpress dashboard and add a new post, like the usual way you do, after that write up your content till the point where you want to break up your content for the next page and write the following commented line there: <!–nextpage–>

This code does the magic, and just paginates your post, keep on adding this code anywhere in the post where you want to break the post into next page. The six times this tag added will break post into six pages.

After composing your post just publish it, and if you can’t see pagination below the first page of the post then you probably don’t have the pagination code in the single.php of your theme. Most of the good theme now a days have the post pagination code,which make appear 1,2 and 3 for the navigation of the post.

Adding wp_page_links for the pagination of WordPress Post:

You need to edit your wordpress theme using the ftp, get one of the best code editor to edit the php file of theme. Go to themes directory and edit single.php of your theme. Here I’ll tell you how to add pagination below the post content. Copy this code and paste it below the the_content() php tag.

 <?php 
  $args = array(
	'before'           => '<p>' . __('Pages:'),
	'after'            => '</p>',
	'link_before'      => '',
	'link_after'       => '',
	'next_or_number'   => 'number',
	'nextpagelink'     => __('Next page'),
	'previouspagelink' => __('Previous page'),
	'pagelink'         => '%',
	'echo'             => 1
);
wp_link_pages( $args );
 ?>

Paste the above code and save your single.php. This will do the magic, and the output will be like in the numbers. If you want to show the next page or previous page, the change the ‘next_or_number’ => ‘number’ to ‘next_or_number’ => ‘next’ and that’s it, you can easily customize the appearance to make it more eye catchy according to your theme.

About the author

Wamiq Ali

Programmer, Blogger and an Entrepreneur trying to make this web a better place by making others learn for free.

Leave a Comment