Hi,
I am trying to get my sidebar to display the entries from a sub category only when the parent category is active.
Example, I have three categories and each have sub categories called Features:
1. Android
- android-features
2. Apple
- apple-features
3. Blackberry
- blackberry-features
Only the Android Sub-Category has content (for now). So in my sidebar, when a user clicks on Android, it should display the ENTRIES from the sub-category “android features”
When a user clicks on Apple - obviously nothing should display.
This is what I have so far in my sidebar
{exp:channel:categories channel="solutions" style="linear" parent_only="yes" show="not 39|40|41|42|61" show_empty="no"}
{if category_url_title == segment_2}
<li class="current">
<a href="/solutions/{category_url_title}" title="{category_name}">{category_name}</a>
{if category_url_title == "{segment_2}"}
{embed="solutions/sidebar-subcat"}
{/if}
</li>
{if:else}
<li>
<a href="/solutions/{category_url_title}" title="{category_name}">{category_name}</a>
</li>
{/if}
{/exp:channel:categories}I embed a template if the category is segment 2. So if it is Android, it pulls in this:
{exp:channel:entries channel="solutions" status="open|unsearchable" sort="desc" dynamic="off" category="{segment_2_category_id}" entry_id="not 124|126|130"}
{if url_title == last_segment}
<li class="subnav-current">
<a href="http://{site_url}{segment_1}/{segment_2}/{url_title}" title="{title}">{title}</a>
</li>
{if:else}
<li>
<a href="http://{site_url}{segment_1}/{segment_2}/{url_title}" title="{title}">{title}</a>
</li>
{/if}
{/exp:channel:entries}I have to omit the entries from the parent categories (Android, Apple, Blackberry).
Obviously this is not the way to do it! With this setup, this template gets called even if there are no entries in the child category.
How can I embed this template only if the child categories have entries. If there are no entries then nothing is displayed.
Thanks!