• Resolved 735697

    Hello,

    new – but nevertheless happy – WordPress user here. ??

    I read through some of the documentation and examples of how to use query_posts() to only retreive posts from a certain category from the database and have them displayed on the front page. Like everything else in WP, it works fine and was easy to set up. But…

    If WP returns more than 10 pages and displays the “Next Page”/”Previous Page” links, the previous page, which should return older posts than those on the first page, shows the same pages as the first one.

    I tried this in two different themes (Box-Set and the default WP theme) and it happened both times, so it doesn’t seem to be a problem with the theme I am using.

    All I did was insert a “query_posts(‘cat=16’)” prior to the loop. Did I forget something?

    Thanks in advance,
    Thomas

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    try this instead:

    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=16&paged=$page");

    see if this solves it!

    Thread Starter 735697

    This seems to work fine, yes. Thanks alot!

    This was an issue that was doing my head in. Thanks for this!

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    A better solution is to include the original query string in your query, then override the bits you want. Like so:
    query_posts($query_string . "&cat=16");

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘query_posts -> Page 2 looks the same as Page 1’ is closed to new replies.