Title: query posts from multiple post types
Last modified: August 22, 2016

---

# query posts from multiple post types

 *  Resolved [artlover578](https://wordpress.org/support/users/artlover578/)
 * (@artlover578)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/query-posts-from-multiple-post-types/)
 * Hello All,
 * I was wondering if someone could help me, i would like to query the latest 5 
   post from my 3 custom post types and woocommerce. but i would like there to always
   be 5 posts all together at any given time. I would really appreciate the help.
 * Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [artlover578](https://wordpress.org/support/users/artlover578/)
 * (@artlover578)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/query-posts-from-multiple-post-types/#post-5170422)
 * If anyone was wondering i found the solution in another post on this forum
 * Here it is :
 *     ```
       <?php query_posts( array(
            'post_type' => array( 'post-type', 'post-type', 'post-type', 'post-type' ),
            'cat' => 3,
            'showposts' => 5 )
            ); ?>
       		<?php while ( have_posts() ) : the_post(); ?>
   
       		<div class="post_type">
   
       		<?php if ( 'post-type' == get_post_type()  ) : ?>FEATURE<?php endif; ?>
       		<?php if ( 'post-type' == get_post_type()  ) : ?>REPORT<?php endif; ?>
       		<?php if ( 'post-type' == get_post_type()  ) : ?>OPINION<?php endif; ?>
       		<?php if ( 'post-type' == get_post_type()  ) : ?>BOOKMARK<?php endif; ?>
       		</div>
   
       		<a href="<?php the_permalink(); ?> "><?php the_title(); ?></a>
   
       		<div class="excerpt">
       		<?php echo get_the_excerpt(); ?>
       		</div>
   
       		<?php endwhile; ?>
       ```
   
 *  Thread Starter [artlover578](https://wordpress.org/support/users/artlover578/)
 * (@artlover578)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/query-posts-from-multiple-post-types/#post-5170423)
 * dont forget to replace post type with your custom post type name

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘query posts from multiple post types’ is closed to new replies.

## Tags

 * [custom-query](https://wordpress.org/support/topic-tag/custom-query/)
 * [multiple post types](https://wordpress.org/support/topic-tag/multiple-post-types/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [Post Types](https://wordpress.org/support/topic-tag/post-types/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [query](https://wordpress.org/support/topic-tag/query/)

 * 2 replies
 * 1 participant
 * Last reply from: [artlover578](https://wordpress.org/support/users/artlover578/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/query-posts-from-multiple-post-types/#post-5170423)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
