I am using a custom post-type, in post there are a checkbox meta field for featured post.
So there are two scenarios.
- First with featured posts
- Second with non featured
When I called featured posts with meta_query
its result 100% perfect.
Here is my code:
$c_clients_args = array(
'post_type' => 'clients_testimonials',
'posts_per_page' => 6,
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'c_client_feature',
'value' => 'on'
)
)
);
$c_clients_result = new WP_Query($c_clients_args);
if($c_clients_result->have_posts()) :
while($c_clients_result->have_posts()) :
$c_clients_result->the_post();
// My result
endwhile;
endif;
But when I call non featured posts with meta_query
the Page goes blank.
Here is my code:
$c_client_args = array(
'post_type' => 'clients_testimonials',
'posts_per_page' => 999,
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'c_client_feature',
'value' => 'on',
'compare' => 'NOT LIKE'
)
)
);
I also tried !=
and NOT IN
So please guide me.
nopaging => true
andposts_per_page => -1
.c_client_feature
meta field exists for non featured posts?