I am trying to exclude a category from wp_count_posts(). I've found hundreds of posts that explain how to do a WP_Query for a specific post type and get a category and then exclude posts with specific terms or tags.
However not very publicized is how to to exclude a few categories from a specific post type. Once I do that I need to return a post count as well
See below what I am working with. Looking for an alternative method for doing what I have below that will allow for me to exclude 3 specific categories.
<?php
$count_posts = wp_count_posts('sponsors');
$published_posts = $count_posts->publish;
$count = $published_posts/7;
$args = array(
'posts_per_page' => -1,
'post_type' => 'sponsors'
);
query_posts($args);
?>
<?php if( have_posts() ) : $i = 0; $f =7; $countr=0; $z = 0;?>
<div class="gallery-sponsors">
<strong class="title">Special Thanks To Our Sponsors</strong>
<div class="mask">
<div class="slideset">
<?php for ($k = 1; $k <= $count; $k++):
$countr = $countr+$f;?>
<?php if ($k==1):?>
<?php else:?>
<?php $i = $i+$f;?>
<?php endif;?>
<div class="slide">
<ul class="sponsors-list">
<?php $z=0;?>
<?php while (have_posts()) : the_post(); ?>
<?php $z++; if ($z<=$countr and $z>$i): ?>
<li>
<div class="img-hold">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'sponsors-gallery-home' ); ?><?php echo $z;?></a>
</div>
</li>
<?php endif;?>
<?php endwhile; ?>
</ul>
</div>
<?php endfor;?>
</div>
</div>
<nav class="pagination"><?php $k =0;?>
<ul>
<?php while ($q<$count-1): $q++;?>
<?php if ($q==1):?>
<li class="active"><a href="#"><?php echo $q;?></a></li>
<?php else:?>
<li><a href="#"><?php echo $q;?></a></li>
<?php endif;?>
<?php endwhile;?>
</ul>
</nav>
</div>
<?php endif;?>
<?php wp_reset_query(); ?>