Multiple category posts on one page

I first want to jump in and say this, you should not be using query_posts, my emphasis, and stated in the codex as well, and I quote

Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

That said, you can use WP_Query to construct your custom loop. You will need to run four different loops here as you are going to display 2 posts each from three different taxonomies and one category. You also need to display the_excerpt() and the_post_thumbnail()

The following parameters can be used here:

  • posts_per_page to set the amount of posts to retrieve to 2
  • cat to get the posts from a specific category for one loop
  • tax_query to get the posts from the taxonomies

Here is the complete query to get the posts from the category. Just change the cat ID to the ID of your category, and add all the html mark up that you need

<?php 
$args = array(
    'cat' => 21,
    'posts_per_page' => '2'
);

$the_query = new WP_Query( $args );

if ( $the_query->have_posts() ) : 
    while ( $the_query->have_posts() ) : $the_query->the_post(); 

        if ( has_post_thumbnail() ):
            the_post_thumbnail();
        endif;

        the_excerpt(); 

    endwhile; 
wp_reset_postdata(); 
endif; 

For the taxonomies, this will do the trick. Remember to go and have a look at WP_Query

$args = array(
'post_type' => 'event_type',
'posts_per_page' => '2'
    'tax_query' => array(
        array(
            'taxonomy' => 'event_cat',
            'field' => 'slug',
            'terms' => 'testcat'
        )
    )
);
$the_query = new WP_Query( $args );

if ( $the_query->have_posts() ) : 
    while ( $the_query->have_posts() ) : $the_query->the_post(); 

        if ( has_post_thumbnail() ):
            the_post_thumbnail();
        endif;

        the_excerpt(); 

    endwhile; 
wp_reset_postdata(); 
endif;