Tutorial :How to display post pagination in wordpress (if possible without a plugin)



Question:

My blog that runs on Wordpress has several pages of posts. I have the page navigation set up (so I have a link for "Older Entries" and "Newer Entries").

I was wondering if it's possible to do something like this:

1 | 2 | 3 | 4 ... 32 | Last Page

EDIT: Thanks to Adam, I replaced the wp_list_pages with the wp_link_pages function as follows:

            <?php $pageargs = array(          'next_or_number'   => 'number'          ); ?>      <ul>          <?php wp_link_pages( $pageargs ); ?>       </ul>  

I also tried just the default:

<?php wp_link_pages(); ?>  

However, it still doesn't work. I'm not getting post pagination. Any ideas?

Thanks, Amit


Solution:1

WordPress › WP-Paginate « WordPress Plugins does that kind of pagination.


Solution:2

I think wp_list_pages deals with listing content pages, whereas what you're looking for is wp_link_pages which provides pagination.

Hope that helps!


Solution:3

You are searching a PageNavigation?

There are so many Scripts for this, the most used one is: WP-PageNavi

It is really easy to implement. You only have to add:

 <?php wp_pagenavi(); ?>  

this to your Template File(s).


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »