How can i get the count for published post from my custom post type , from my taxonomy.
I have Custom Post Type : trailers, Taxonomy : trailere-noi
<?php
$items = get_posts( array(
'post_type' => 'trailers',
'numberposts' => -1,
'taxonomy' => 'trailere-noi',
));
$count = count( $posts );
echo $count;
?>
I use this code it conunt for how posts are display.. how can get the count for all posts in that taxonomy?
Response:
<?php
$related_posts = get_field( 'subtitrare_film' );
$count = count( $related_posts );
echo $count;
?>
Subtitrare_film - is the relathionship field (INFO :http://www.advancedcustomfields.com/docs/field-types/relationship/) This code Retrive me the field counting number, but the problem is: if there is nothing atached to that Custom Field ( Relationship fild) it retrive me number 1 , i want to display 0 ( if there is nothing atachhed.)
$itemsnot$posts.$count = count($items);– s_ha_dum Jan 12 at 15:47