I have this WP_Query
<?php
$args = array(
'post_type' => 'banner',
'posts_per_page' => 25 ,
'meta_query' => array( 'relation' => 'AND',
array('key' => 'ads_status','value' => '1'),
array('key' => 'adsposition','value' => 'top'))
);
$slide = new WP_Query( $args );
if ( $slide->have_posts() ) : while ( $slide->have_posts() ) : $slide->the_post();
$yourfile = get_post_meta(get_the_ID(), 'yourfile', true);
$adsposition = get_post_meta( get_the_ID(),'adsposition', true ); ?>
<img src="<?php echo $yourfile; ?>" width="1350" height="515">
<?php
endwhile; endif;
wp_reset_query();
?>
I have tow meta box (ads_status,adsposition) and its saved good in wp-admin, but in home page not show any result, but when delete meta_query
, Its work and get me result.
Where the error ??