Forums

query posts and paging issue with older posts (5 posts)

  1. Jacorre
    Member
    Posted 1 year ago #

    I am using the following on a category specific template file:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($paged . "&showposts=5&cat=3&paged=$paged");
    ?>

    The first couple pages work, but when I click the 3rd or any more pages, I get nothing found?

    Did something change with paging using the method above?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($paged . "&showposts=5&cat=3&paged=' .$paged);
    ?>
  3. Jacorre
    Member
    Posted 1 year ago #

    Hi esmi, I tried using the following:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($paged . '&showposts=5&cat=3&paged=' .$paged);
    ?>

    It didn't make a difference. Again, only the first two pages worked, any page after that does not work.

    I'm noticing that it seems to happen with category specific template files.

    For example, this one uses category-3.php. Any other template file where I use the same query posts with paging, it's not a problem.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    You could try swapping showposts for posts_per_page.

  5. Jacorre
    Member
    Posted 1 year ago #

    I have also tried swapping that out.

    If I do not use query_posts, the paging works but I want to define a different number of posts per page so that's why I want to use query_posts.

    If I introduce query posts as follows:

    <?php global
    $query_string;
    $posts = query_posts($query_string.'&posts_per_page=5&cat=3');

    I no longer get an issue with clicking on page 3 and it not finding any posts. However, it stops at that point and doesn't provide the rest because I know there's more than 15 entries. Very strange.

Topic Closed

This topic has been closed to new replies.

About this Topic