WordPress.org

Ready to get started?Download WordPress

Forums

include multiple categories with query_post($args); (2 posts)

  1. schmackLab
    Member
    Posted 4 years ago #

    here is my code

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array(
    'cat' => 3,14,
    'posts_per_page' => 9,
    'paged'=>$paged,);
    
    query_posts($args);

    I need to pull from category 3 and 14 but this does not work. How can I pull from both categories with this syntax?

    I am stuck with this code since it's the only way I've gotten custom loops to paginate properly.

    Thanks for your help!

  2. wprelief
    Member
    Posted 4 years ago #

    Change that to:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array(
    'cat' => array(3,14),
    'posts_per_page' => 9,
    'paged'=>$paged,);
    
    query_posts($args);

    with "array" and you should see better results.

Topic Closed

This topic has been closed to new replies.

About this Topic