query_post by meta_key only without specific category setting not works
-
Hi. I’m using WordPress 2.9.2. I want to query both posts and pages that have the custom field “Banner home”. So, I’m doing a query_posts call.
But instead I set post_type=any, the query doesn’t works. It only works If I call to an specific category or page.My code looks like this:
<?php $args=array('post_type' => 'any', 'post_status' => 'publish', 'meta_key' => 'Banner home', 'posts_per_page' => 3); $my_query_bannerhome = new WP_Query($args); ?> <?php if ($my_query_bannerhome->have_posts()) : while ($my_query_bannerhome->have_posts()) : $my_query_bannerhome->the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> // My stuff </div> <?php endwhile; endif; ?>
What I’m doing wrong?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘query_post by meta_key only without specific category setting not works’ is closed to new replies.