When I need to get a single post type list I usually use
get_posts, how can I retrieve multiple
custom posts types to populate the site homepage?
To be more precise, I would like to get the latest mixed posts (so mixed slugs like work, photo, code) and oreder them by date.
I could call
get_posts per each custom post type and then filter them, but I was just wondering if there was a more optimized way to do it, something like:
<?php $args = array ( 'post_type' => array ('work', 'photo', 'code', 'post'), 'numberposts' => 5, 'orderby' => 'post_date', 'order' => 'DESC' ); $posts_array = get_posts($args); ?>
So, does exists some way to get a mixed post type list?