Really excited about WordPress 3. No more workaround to deliver a simple interface for my clients! But, since my PHP skills are very limited (minimal, really) I was wondering how can I query two or more custom posts types in the same query – like a most recently added posts feature in the footer. I used to do this with categories like this:
<?php query_posts('cat=3,4&showposts=10&order=DSC'); ?>
I research a lot in the web and found this code for the loop:
<?php global $wp_query; $wp_query = new WP_Query(array( 'post_type' => 'destaques', 'posts_per_page' => 10, 'post_status' => 'publish')); while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
I works fine with one post_type, but when I put a second post_type it won´t work.
Please, if anyone can, help me!
- The topic ‘Query two or more custom posts (wordpress 3.0)’ is closed to new replies.