WordPress.org

Ready to get started?Download WordPress

Forums

posts_nav_link() and query_posts() problem (2 posts)

  1. jakesee
    Member
    Posted 4 years ago #

    hi all,

    Hope someone can help. Thanks a lot.

    There is a previous discussion here http://wordpress.org/support/topic/57912?replies=9 but it's talking about category and it seems like it doesn't work for my showposts on home page.

    <?php
    // this code is in header.php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("showposts=1&paged=$paged");
    }
    ?>

    posts_nav_link() generates an "older post" on home page to link to page 2, but nothing is when: There are 4 posts in total,and settings in admin>settings>reading>at most 5 blog posts.

    if admin>settings>reading>at most 2 blog posts. page 2 shows 1 post (instead of 2 posts) and the post is the second next oldest post. posts_nav_link() generates an "older post" link to page 3, but page 3 is blank.

  2. Durgé Seerden
    Member
    Posted 4 years ago #

    If I may ask, why do you use query_posts() instead of the loop?

    I think if you would just use the loop, you could copy paste it from the default theme you're not into coding and modify it so it will work in you theme, the problems will be solved.

    Greetz,

    Durgé
    Dimics.com

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.