2

I am trying to build a listing page of entries broken down by parent category.

I originally used the category archive tag but there isn't option to limit the entries per category.

I've also tried using Stash and this method marked as the answer Listing entries, ordering by Category

It works by showing all entries under each parent category, but once I throw the limit parameter in the channel entries tag it doesnt work, just shows the categories. Also tried using MX Jumper, same result.

I found this method from Low http://gotolow.com/blog/nesting-tags-and-performance-in-ee It works the same, but again once limit parameter is in channel tag it breaks.

However I have found that placing the category_group parameter in the channel tag that it works, sorta. It will show entries, but whatever the limit is instead of limit per category.

Below is my code for Stash:

{exp:channel:entries channel="publications" disable="pagination|member_data|category_fields" dynamic="no" limit="5"}
  {exp:stash:append name="publications_{categories limit='1'}{category_id}{/categories}" parse="inward"}
    <p>{title}</p>
  {/exp:stash:append}
{/exp:channel:entries}

{exp:channel:categories channel="publications" style="linear" disable="category_fields" show_empty="no" parent_only="yes"}
  <h3>{category_name}</h3>
  {exp:stash:get name="publications_{category_id}"}
{/exp:channel:categories}

Any thoughts on how to build out a entry list organized by category where you can set a limit of entries to show per category?

I do have Auto-Assign to Category Parents marked yes. I've disabled extensions one at a time to see if one was causing any issues, found nothing.

UPDATE I do realize that putting limit on channel tag would limit it to 5 entries no matter their categories. Looking to limit it to 5 entries per category.

Much thanks in advance!

0

Try flipping your code around like this.

{exp:channel:entries channel="publications" dynamic="no"  disable="category_fields|member_data|pagination"}
    {categories}
        {exp:stash:append_list name="publications_{category_id}"}
            {stash:title}{title}{/stash:title}
        {/exp:stash:append_list}
    {/categories}
{/exp:channel:entries}

and

{exp:channel:categories channel="publications" style="linear" disable="category_fields" show_empty="no" parent_only="yes"}
    <h2>{category_name}</h2>
    <ul>
        {exp:stash:get_list name="publications_{category_id}" limit="5"}
            <li>
                <h3>{title}</h3>
            </li>
        {/exp:stash:get_list}
    </ul>
{/exp:channel:categories}
| improve this answer | |
  • You're welcome. I just had to build the same thing:) – Anna_MediaGirl Sep 20 '13 at 17:08

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.