• Resolved shagen

    (@shagen)


    Having trouble with my next and previous entries on our blog. I have to preface it with the fact that have split the loop into two separate pages in which any post with the tag “blog” goes with blog.php and any post with the tag “news” will go to the index.php page.

    The problem I have is when you hit the “next page” button on either page it just reloads the same loop instead of showing the next set.

    You can visit the site here…

    http://www.qualvu.com/blog/

    The code on each page looks like this…

    <div class="alignleft">
    <?php posts_nav_link('','','« Previous Entries') ?>
    </div>
    <div class="alignright">
    <?php posts_nav_link('','Next Entries »','') ?>
    </div>

    Not sure what I am missing and why it will not show the next set of posts. Also if it does advance the next set of pages will still need to only show tagged posts from either “blog” or “news”.

    Any thoughts as to what I am missing and doing wrong here. Is it shifting to an archive page?

    Also, once I do hit the next page button then it shows the next/previous buttons again. Not sure what I did there either. Thoughts?

    Thanks for any time in which you have reviewed and tried to answer my issues, it is much appreciated! Let me know if you have any questions.

Viewing 7 replies - 1 through 7 (of 7 total)
  • have split the loop into two separate pages

    What are you using for your custom query on each page?

    Thread Starter shagen

    (@shagen)

    [Code moderated as per the Forum Rules. Please use the pastebin]

    The only difference in the main index loop is that instead of ‘tag=qualvu-news’ it would be ‘tag=qualvu-blogs’

    Thread Starter shagen

    (@shagen)

    Sorry about the code posting infraction there. Here is an updated pastebin code reference URL…

    http://wordpress.pastebin.ca/2038233

    Still having the same problem though.

    Thread Starter shagen

    (@shagen)

    So I have narrowed the issue somewhat. Hoping that by explaining this issue someone will be able to make a suggestion.

    When removing the line…

    <?php query_posts('tag=qualvu-news'); ?>

    …from my index page the pagination and next posts work perfectly. Once I put that back in then whenever I hit the “Next Page” link at the bottom of that particular page then it just loads the same set of post even though I know that there are more post for that category.

    On the blog page when removing the following code it will not even run the loop at all.

    <?php query_posts('tag=qualvu-blog'); ?>

    Obviously there is an issue with ‘query_posts’ and how it is interacting with ‘posts_nav_link’.

    Any further help or suggestions with the issue would be much appreciated. Let me know if you need anything else that may help you determine the problem. Again you can see the loop/template page code at the following url…

    http://wordpress.pastebin.ca/2038233

    You can see the actual issue on the site at the following URL…

    http://www.qualvu.com/news-events/

    Thread Starter shagen

    (@shagen)

    Worked perfectly! Thanks so much for your time and suggestion. Here is the final code that I ended up with based on your URL suggestion above…

    <?php query_posts( array(
         'posts_per_page' => 5,
         'tag' => 'blog',
         'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),));
    ?>

    Glad it worked out for you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘posts_nav_link organized by tag – next page not working properly’ is closed to new replies.