Global post array not showing the right amount? (3 posts)

  1. bencharity
    Posted 5 years ago #

    I am using a global post array to return a list of posts from a certain category as outlined here: http://codex.wordpress.org/Template_Tags/get_posts

    But no matter what number I include with 'posts_per_page' => 10' within the array, it only shows five. It is obviously seeing what I put it because it responds to sort commands and the category selection. Am I missing something?

    My query:

    global $post;
    $args = array('category' => 40, 'posts_per_page' => 10);
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :	setup_postdata($post);

    See it here: http://benjamincharity.com/code-snippets/

  2. Sergey Biryukov
    WordPress Dev
    Posted 5 years ago #

    Try numberposts parameter.

  3. bencharity
    Posted 5 years ago #

    Ahhh that worked!! Thank you so much Sergey!

Topic Closed

This topic has been closed to new replies.

About this Topic