Displays page-links for paginated posts of wordpress

November 18, 2008 · Print This Article

Did you know that WordPress allows you to cut and slice a long post into different pages?

First, When you want to break a long article into pages, you need to includes the <!–nextpage–> Quicktag one or more times to the point where you wish to make a break in your long entry.

Then, displays page-links for paginated posts in your template using link_pages() or wp_link_pages().

Most of the themes do not have necessary template tag in place, if your pagination links don’t show up at the bottom of your post you will need to edit your template.

Open single.php and page.php with a text editor and look for following line:

<?php the_content('Read the rest of this entry »'); ?>

If use link_pages(), replace it with:

<?php the_content('Read the rest of this entry »'); ?>
<?php link_pages('<p>Page:', '</p>', 'number', '', '', '%'); ?>

If use wp_link_pages(), replace it with:

<?php the_content('Read the rest of this entry »'); ?>
<?php wp_link_pages('before=<div id="page-links">Page:&after=</div>'); ?>

Hope you enjoyed this quick tutorial about how to make pagination for single entries in WordPress.

Reference:
http://codex.wordpress.org/Template_Tags/link_pages
http://codex.wordpress.org/Template_Tags/wp_link_pages


Related articles:

Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.