1

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.

1
  • 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} – Dennis Eusebio Feb 6 '14 at 13:41
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}
{/exp:channel:categories}
3
  • Didn't think to use that if statement to prevent looping, thanks!. Is there a way to count categories that have entries in them? – Dennis Eusebio Feb 6 '14 at 13:33
  • Count entries in categories? Or show only not empty (which is already in example)? – Max Lazar Feb 6 '14 at 14:05
  • I figured it out. The above code worked! – Dennis Eusebio Feb 7 '14 at 14:34

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.