Display all posts from specific categories on a page

I’d Advise adding the arg of the category in an array. And don’t use query_posts.
Also showposts is deprecated use posts_per_page instead.

$args = array (
    'cat' => array(2,6,9,13),
    'posts_per_page' => -1, //showposts is deprecated
    'orderby' => 'date' //You can specify more filters to get the data 
);

$cat_posts = new WP_query($args);

if ($cat_posts->have_posts()) : while ($cat_posts->have_posts()) : $cat_posts->the_post();
        get_template_part( 'content', 'page' );
endwhile; endif;

Leave a Comment