Display Article Count

I searched the forum and couldn’t see this answered before so here goes… I want to count all the articles belonging to a tag and out put the number.

<?php $tags = $pages->children()->pluck('tags', ',', true); ?>
<ul class="draw">
<?php foreach ($tags as $tag): ?>
<li class="cat"><a href="<?php echo url('works/tag:'.$tag)?>"><?php echo html($tag) ?><span>NUMBER</span></a></li>
<?php endforeach ?>
</ul>

how do i replace NUMBER with the actual number of articles please?

Thanks.

$number = $pages->children()->filterBy('tags', $tag)->count();
2 Likes

Brilliant… Thank you kind sir!