2

Is there a way to select channel, list out the categories assigned to that channel and then the number of entries in each category?

What I want is something link the below:

Category 1 - 100 entries Category 2 - 70 entries etc...

I've tried this, but dosn't get me what I want:

{exp:channel:categories channel="news"}
                  <li>
                    <a href="#">{category_name} ({exp:channel:entries category="{category_id}" dynamic="no"}{absolute_results}{/exp:channel:entries})</a>
                  </li>
                  {/exp:channel:categories}

2 Answers 2

4

Yes, this is possible. You can do this by making simple template and embed.

Create one template template_name.html in your template group and insert below code.

{exp:channel:categories channel="channel_name" disable="category_fields"}
    *******************************************************
    <br>

    Category Name : {category_name}
    <br>

    {!-- including the embed which have channel entry code --}
    {embed="template_group_name/.embed_name" cat_id="{category_id}"}

    *******************************************************
    <br>
{/exp:channel:categories}

Now create one embed .embed_name.html into that template group. And insert below code.

{exp:channel:entries channel="channel_name"
disable="category_fields|member_data|pagination|trackbacks|relationships" dynamic="no" 
category="{embed:cat_id}"}

    {if count == 1}
    Total Entries = {total_results}<br>
    {/if}

{/exp:channel:entries}

I hope this will definitely works for you.

1

this feature is not supported Natively you can use the query module for this or third party

http://gwcode.com/add-ons/gwcode-categories/examples/example4

This add-on has been ported to EE3 / EE4 compatibility - though labelled as a beta the updated version works well. Find the updated version discussed in this thread, and the downloadable version here.

2
  • Hi Akwad, thanks for your help. It's an EE 4 site, so it's a shame that's not being ported, it would have being perfect.
    – Mark
    Commented Sep 19, 2018 at 8:08
  • thats why I am moving away from EE EE is fading out
    – Akwad Net
    Commented Sep 19, 2018 at 23:22

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.