Looking to create an overall stat statement that can return these stats:

View {# of entries in channel "distributors"} in {# of categories with entries within channel "distributors"}

Need it to only count the categories that have entries, not the empty ones. I know I can do that first portion, but wonder how to do the second. Also, can't quite figure out what combination of exp:channel tags I'd need to use.

  • Here's what I came up with, based on Max's answer: {exp:channel:categories channel="distributors" style="linear" show_empty="no"} {if count == 1} <h2 class="view_areas"> <a href="#"> {exp:channel:entries channel="distributors"} {if absolute_count == 1} View our {absolute_results} distributors in {/if} {/exp:channel:entries} {total_results} states </a> </h2> {/if} {/exp:channel:categories} Feb 6, 2014 at 13:41

1 Answer 1


The most simple way in this case is use exp:channel:categories tag

{exp:channel:categories channel="news" style="linear" show_empty="no"}
    {if count == 1} {total_results} {/if}
  • Didn't think to use that if statement to prevent looping, thanks!. Is there a way to count categories that have entries in them? Feb 6, 2014 at 13:33
  • Count entries in categories? Or show only not empty (which is already in example)?
    – Max Lazar
    Feb 6, 2014 at 14:05
  • I figured it out. The above code worked! Feb 7, 2014 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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