user2861858
user2861858

Reputation: 5

Latest posts from multiple post types in one single loop?

As the title says. Is there any way to get the latest posts from multiple post types in one single loop? Without using wpdb if at all possible?

Upvotes: 0

Views: 168

Answers (1)

harveybirdman
harveybirdman

Reputation: 11

I believe using WP_Query(), you can choose an array of post types. Here is an (untested) example:

<?php
$query = new WP_Query($args);
$args = array(
    'post_type' => array('post', 'custom-post-type'),
    'posts_per_page => 3
);
?>

More info on WP_Query().

Upvotes: 1

Related Questions