I have custom post type and created one custom field checkbox called is_featured
.
I have to show the post which is the checkbox is selected so I have used the below code and it’s working
function isFeatured($atts){
global $post;
$args =array(
'post_type' => 'postname',
'post_status' => 'publish',
'posts_per_page' => 30,
'meta_key' => 'isfeatured',
'meta_value' => 1,
'order' => 'DESC',
'orderby' => 'post_date',
);
$related = new WP_Query($args);
if( $related->have_posts() ) {
$data = '<ul>';
while( $related->have_posts() ) {
$related->the_post();
$data.= '<li></li>';
}
$data .='</ul>';
return $data;
wp_reset_postdata();
}
}
add_shortcode( 'is-featured', 'isFeatured');
Now, My issue is, How to show the post which checkbox is not selected?