0

I am trying to display the parent category as a heading and then display the children with links to a template that will display the entries form the child category. This is where I have started and I cannot get the children to display based on the dynamic segment 5 even using low's seg to cat.

    {exp:channel:categories channel="work" show_empty="yes" style="linear" parent_only="no" show="{last_segment_category_id}"}

PARENT CATEGORY as a heading. 

<a href="{path='portfolio/page'}">Child Category <img src="{category_image}" border="0"/></a>
    <br style="clear:both;" />


             <a href="{path='portfolio/page'}">Child {category_name}</a>
<br style="clear:both;" />    <br style="clear:both;" /><br style="clear:both;" /><br style="clear:both;" />
        {/exp:channel:categories}
2

The native categories tag pair's "show" parameter doesn't look recursively into the specified category - it's still a one-to-one filter, which would require you to pipe the child category IDs into it, even with the parents_only param set to no (that only works if you are dynamically displaying the full array of categories within a category group, for example). You should be able to do what you're looking to do though by using GWCode Categories in concert with Seg2Cat, since GWCode Categories will allow you to specify a start point in your category tree and look recursively inward, using Seg2Cat to target the segment identifying your start point and convert it to an ID, as you've aimed to do with the native tag pair.

| improve this answer | |
  • thanks Jean, I was trying that yesterday with no success. Tried it again after som esleep and seems to work for me <h1>{last_segment_category_name}</h1> {exp:gwcode_categories cat_id="{last_segment_category_id}" last_only="yes"} {cat_name} {/exp:gwcode_categories} – Peter Eastwood May 7 '13 at 12:56
  • Bingo! Nice to have that kind of control in a categories loop, even if it's not native. – Jean St-Amand May 7 '13 at 14:29

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.