WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Query posts and Post Nav link doesnt work together (6 posts)

  1. a_perfect_oblong
    Member
    Posted 5 years ago #

    Hi guys,

    I've been stuck with this for quite some time now and havent really found a solution on the web.

    Right now i'm using:
    <?php query_posts('category_name=Sub articles&showposts=4'); ?>

    to display posts that belong only to the 'Sub article' section and display a max of 4 posts per page.

    at the bottom of the loop, i used <?php posts_nav_link(); ?> so previous and next buttons would appear and the viewers will be able to read other posts in that same category.

    Problem is, when i click on next or previous, the other articles don't show up and still displays the current 4 posts i have at the beginning. but when i took out the query posts, post nav link actually worked.

    But i definitely need query posts because i'm displaying posts by category so i cant just ignore it.

    Has anyone encountered this and have any solutions for me? thanks, any help would be dearly appreciated. Thanks again!

  2. huggies
    Member
    Posted 5 years ago #

    I have just encountered this myself...would love to find a solution.

    Thanks in advance!

  3. mukustudios
    Member
    Posted 5 years ago #

    I'm having the same problem.

  4. Coffee4cr
    Member
    Posted 5 years ago #

    I have this exact problem too

  5. Mark / t31os
    Moderator
    Posted 5 years ago #

    Problem relates to not using $paged...

    Search the forums, it has been answered before.

  6. easetock
    Member
    Posted 5 years ago #

    Take a look at this: http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/

    I have used this to query posts and it finally worked out well with pagination:
    <?php query_posts('cat=1'.'&paged='.$paged); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic