how do I add pagination into my theme? (5 posts)

  1. mr_badger
    Posted 5 years ago #

    I'm creating a theme but for some reason I cannot get even the basic next previous links to work in my pages.

    I have created a page template called page1 so my page url is http://www.websitename/page1 but when I add <div class="page-navigation"><p><?php posts_nav_link(); ?></p></div> it does show up the right amount of pages there should be but when I click on next it doesnt show the next set of blog entries.

    I do have a php query post on that page if that means anything but just need this solving and I know this will be very very simple to acheive but I just can't figure it out.

    Thankyou for any help.

  2. Michael
    Forum Moderator
    Posted 5 years ago #

    does the query in your page template contain the 'paged' parameter?


    if you need assistance with the coding, post the query here (if the code is longer than 10 lines, please use the http://pastebin.com/)

  3. mr_badger
    Posted 5 years ago #

    no, it just queries the post category <?php query_posts('category_name=bars&showposts=5'); ?> so there is no paged parameter

  4. Michael
    Forum Moderator
    Posted 5 years ago #

    try and add the 'paged' parameter;
    <?php query_posts('category_name=bars&showposts=5&paged=' . get_query_var('paged')); ?>

  5. mr_badger
    Posted 5 years ago #

    yes, thankyou very much for your kind help, this has now solved the problem and is working fine.


Topic Closed

This topic has been closed to new replies.

About this Topic