Forums

query_posts exclude not working with paging (2 posts)

  1. arnie2
    Member
    Posted 2 months ago #

    Hi,

    i want to display posts only from 4 of 5 categories. The query_posts('cat=-24') is working correctly untill I want to show all the posts on one page. When i set to display only 3 posts per page (reading settings), on the next page are displayed the same posts as on the first one and the whole thing is not working on other than the first page :/

    Is it required to make an extra setting ?

    the query_posts statement is inserted in index.php before the loop
    while ( have_posts() ) : the_post()

    Thanks a lot guys ..

  2. MichaelH
    moderator
    Posted 2 months ago #

    This should help:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=-24&paged='.$paged);

    You might also find this plugin useful:
    http://wordpress.org/extend/plugins/custom-post-limits/

Reply

You must log in to post.

About this Topic