I’m looking to display only the child categories of a parent in an entries loop.
For example, I have a category structure similar to the following:
Parent 1 - Child 1 – Child 2 – Child 3
Parent 2 - Child 1 – Child 2 – Child 3
I am using a URL segment to figure out the parent category, which works just fine (with a bit of PHP to get the category ID from a nice-looking URL). I know there are probably a couple of ways to do this, but my needs are pretty specific. I want to display the parent name, description and a couple other custom fields on the page and then list the entries within the parent, but only show the sub-category name for each entry.
For example:
Page Title: Parent 2 Category Description: Aliquam et nisl vel ligula consectetuer suscipit. Morbi euismod enim eget neque. Donec sagittis massa. Vestibulum quis augue sit amet ipsum laoreet pretium. Nulla facilisi. Duis tincidunt, felis et luctus placerat, ipsum libero vestibulum sem, vitae elementum wisi ipsum a metus. Nulla a enim sed dui hendrerit lobortis. Donec lacinia vulputate magna. Vivamus suscipit lectus at quam. In lectus est, viverra a, ultricies ut, pulvinar vitae, tellus. Donec et lectus et sem rutrum sodales. Morbi cursus. Aliquam a odio. Sed tortor velit, convallis eget, porta interdum, convallis sed, tortor. Phasellus ac libero a lorem auctor mattis. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Entries: Entry 1 (link) Category: Child 1
Entry 2 (link) Category: Child 1
Entry 3 (link) Category: Child 3
So the entries are children of Parent 2, but I don’t want “Parent 2” displayed at the entry level.
Currently I have this working using two category groups, one for the parent, and another for the parent-child relationships. This seems like a lot of overhead though. I’ve explored the subcategories plugin but it didn’t seem to do what I needed. I’ve also explored a custom query, but that got pretty messy based on input/output parsing.
Any help would be appreciated. Thanks!
UPDATE: I’m worried I posted in the wrong Topic but cannot seem to move the post.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.