I am using this code to get posts of specific taxonomy. It displays 10 posts by default. How can I set my own limit?

    $count = 1; 
    $the_query = new WP_Query( array( 'brand' => 'sony-vaio' ) );
    while ($the_query->have_posts()) : $the_query->the_post();

To display 5 posts, say, use posts_per_page. See the Codex.

$the_query = new WP_Query( array( 'brand' => 'sony-vaio','posts_per_page'=>5 ) );
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.