I am trying to display the number of posts within each of my custom taxonomy terms. I just need to show if there's 2, 3 10, etc # of posts within my terms. This is my code. Looking for a way to include it in this and still be able to style it individually.


            'hide_empty'        => 0,  
            'parent'        => 0,  
            'taxonomy'      => 'industrygroups');  


            foreach($libcats as $lc){ 
            echo '<div class="col-lg-3">';
                $termlink = get_term_link( $lc->slug, 'industrygroups' ); 

           <p class="text-center"> <a href="<?php echo $termlink; ?>">
 <img class="img-responsive img-thumbnail" src="<?php the_field('taximage', 'industrygroups_'.$lc->term_id); ?>" />
   <br />
            <?php echo $lc->name; ?></a></p>
                     <?php the_field('basictext', 'industrygroups_'.$lc->term_id); ?>

        <?php   echo '</div>'; }?>

The category objects returned by get_categories() include a property of count:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.