Forums

Custom category loop issues (10 posts)

  1. Everton
    Member
    Posted 2 years ago #

    Hi

    I'm hoping someone here can help me please. I've created a custom category page that contains multiple loops e.g.

    http://windows7news.com/category/windows7-guides/

    but when I use the pagination tool at the bottom to see the rest of the posts in that category it shows the same posts (the ones with thumbnails)again:

    http://windows7news.com/category/windows7-guides/page/2/
    http://windows7news.com/category/windows7-guides/page/3/

    How do i fix this? Here's my full code-thanks in advance for any help.

    EB

    [moderated Please paste the code into a pastebin such as wordpress.pastebin.ca, and report the link back here.]]

  2. Everton
    Member
    Posted 2 years ago #

    here's the pastebin link:

    http://wordpress.pastebin.ca/1680292

  3. Everton
    Member
    Posted 2 years ago #

    can anyone help?

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    I don't see any previous_posts_link() and next_posts_link() constucts so look at the WordPress Default themes index.php for examples of those.

    But you might try changing that last query from:

    <?php query_posts('category_name=windows7-guides'.'&paged=' . $paged); ?>

    to

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=windows7-guides'.'&paged=' . $paged);
    ?>
  5. Everton
    Member
    Posted 2 years ago #

    Hi MichaelH

    thanks for trying to help - same problem I'm afraid!

    EB

  6. Everton
    Member
    Posted 2 years ago #

    anybody have any other ideas?

  7. Everton
    Member
    Posted 2 years ago #

    bump trying to keep this alive

  8. MichaelH
    Volunteer
    Posted 2 years ago #

    Seems you have plugins handling the navigation, and you've got includes in your loop, so maybe need to point you here:

    http://www.google.com/search?q=wordpress+pagination+and+query

  9. Everton
    Member
    Posted 2 years ago #

    thanks for the advice of using google...can anyone provide any help that's a bit more substantial?

  10. Mark / t31os
    Moderator
    Posted 2 years ago #

    A good wealth of these would still be relevant.
    http://wordpress.org/tags/pagination
    http://wordpress.org/tags/paged

    The key here, as Michael has already shown in his initial response, is setting up the $paged variable, or at least the paged parameter inside the query_posts line, since this ultimately controls, and sets, the offset positions in the query, ie. your LIMIT clause in the end SQL query..

    Ideally what i believe you should do, is drop the built-in paging and write your own. I say this simply because i don't think query_posts is equipped to deal with 4 queries (all using query_posts) and paging them..

    You could look at plugins for examples, but i can't say i know any particular plugins specifically that cover this (i'm sure it's been done though).

Topic Closed

This topic has been closed to new replies.

About this Topic