• I am using this to display one page that is part of a category but, this is displaying all the entries. Does anyone have a solution?

    $args = array(
    ‘numberposts’ => 1,
    ‘post_type’ => ‘page’,
    ‘post_parent’ => ‘6’,
    ‘order’=> ‘DESC’
    );
    query_posts($args);

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try changing to ‘posts_per_page’.

    To get pagination to work, you will also need to include the ‘paged’ argument and the code to display the pagination.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
       'posts_per_page' => 1,
       'post_type' => 'page',
       'post_parent' => '6',
       'order'=> 'DESC',
       'paged' => $paged
    );
    query_posts($args);

    The exact code for the pagination links depends on your theme. It usually uses calls to next_posts_link() and previous_posts_link().

    Thread Starter MG7282

    (@mgrinshpun)

    Thank you that worked! But, now the comment box that is being displayed on each individual page is not being displayed on the page where the query is happening. any ideas?

    That feature depends on your theme. Many themes do not allow comments for lists or groups of posts, only on single posts.

    Thread Starter MG7282

    (@mgrinshpun)

    This is what my page looks like:

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

    It still depends on your theme. The code you gave shows a call to comments_template(). That usually loads comments.php, so the code there may be different in your theme.

    If you are using a free theme, please post a link to your site here. If you are using a paid theme, contact the theme supplier.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘numerposts argument not working’ is closed to new replies.