Hi Michael. Mmmmm...I's weird. It's doesn't work for me. I just change your code to this:
<?php
$args=array(
'meta_key'=>'Banner home',
'post_type' => 'any',
'post_status' => 'publish',
'posts_per_page' => 3,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<?php if ( function_exists( 'get_the_image' ) ) { get_the_image(
array(
'custom_key' => array( 'Banner home' ),
'default_size' => '',
'attachment' => false,
'link_to_post' => true,
'image_scan' => false,
'width' => '980',
'height' => '350',
)); } ?>
</div>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
I'm doing other query calls in the same page, but if I put the code alone, nothing happens.
My code only works If I use this:
`<?php $args=array('post_type' => 'any', 'post_status' => 'publish', 'meta_key' => 'Banner home', 'posts_per_page' => 3, 'category_name'=>'noticias');
$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(); ?>">
<?php if ( function_exists( 'get_the_image' ) ) { get_the_image(
array(
'custom_key' => array( 'Banner home' ),
'default_size' => '',
'attachment' => false,
'link_to_post' => true,
'image_scan' => false,
'width' => '980',
'height' => '350',
)); } ?>
</div>
<?php endwhile; endif; ?>`
If I remove 'category'=>'noticias', the query doesn't display any post instead of 'post_tye'=>'any'