I feel like I’m “this close” but can’t figure out these last steps. I’m hoping someone can lend some advice.
I’m trying to set up a page which lists all entries by the category selection, but sort them by the subcategory of said category. I’m using the subcategories plugin, but not sure it’s the answer I’m looking for.
Imagine if I have 1 parent category, with 3 subcategories and 9 total entries. Entries 1,4 and 5 belong to Subcategory 1. 2,3 and 9 belong to Subcategory 2. Entries 6, 7 and 8 belong to Subcategory 3. I’d like to return something like this:
Category A
Subcategory 1
- Entry 1
- Entry 4
- Entry 5
Subcategory 2
- Entry 2
- Entry 3
- Entry 9
Subcategory 3
- Entry 6
- Entry 7
- Entry 8Here’s the code I have so far:
{exp:subcategories sort_by="custom_order" root_node="36"}
{category_name}
{exp:weblog:entries weblog="training" limit="200" cat_limit="100" orderby="date" sort="desc" disable="member_data|trackbacks"}
{switch="<div style='padding:10px; *padding-top:10px;'>||"}
{switch="<div class='grid3col'>||"}
<div class="{switch="column first|column|column last"}">
<h3>{if icon}<a href="http://{location}">{icon}</a>{/if}
<a href="http://{location}">{title}</a></h3>
<p> <div class="blurb"> </p>
<p> {date_heading}{entry_date format=' %Y-%m-%d '}: {/date_heading}</p>
<p> {if desc}<br />
{exp:word_limit_plus if_exceeds="30" stop_after="28"}<br />
{desc}<br />
{/exp:word_limit_plus}<br />
{/if}<br />
<a href="http://{location}">Read more.</a><br />
</div></p>
<p> </div></p>
<p><br />
{switch="||</div>"}<br />
{switch="||</div>"}</p>
<p> {/exp:weblog:entries}<br />
{/exp:subcategories}While I’m getting a list of all the subcategories, I’m getting all the entries from the parent category under each subcategory. I’d only like to display the entries specific to each subcategory.
Any help is much appreciated.