Ho provato in questo modo per visualizzare NO di post:
<?php
$news_2 = new WP_Query( array ('post_type'=> 'jobs','posts_per_page'=> '10' , 'meta_key' => 'status_for_jobs','meta_value' => '1') );
if ( $news_2->have_posts() ) { while ( $news_2->have_posts() ) { $news_2->the_post();
$count = $news_2->post_count;
?>
<li><h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3></li>
<?php } } ?> <?php wp_reset_query(); ?>
se il NO di post = 0 devo visualizzare questo: -
<?php
$news_2 = new WP_Query( array ('post_type'=> 'jobs','posts_per_page'=> '10' , 'meta_key' => 'status_for_jobs','meta_value' => '1') );
if ( $news_2->have_posts() ) { while ( $news_2->have_posts() ) { $news_2->the_post();
$count = $news_2->post_count;
if ($count == '0') {
?>
<li><h3><a href="javascript:void(0)">No Post</a></h3></li>
<?php
} else {
?>
<li><h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3></li>
<?php } ?>
<?php } } ?> <?php wp_reset_query(); ?>
Ma invece del totale dei post, non ottengo nulla.
Qualche suggerimento per risolvere questo problema?