0

Based on one of GWCode Categories examples I have created code below

<li class="submenu-parent">
<a href="#">Product Type</a>
<div class="submenu cf" id="submenu-1">
    {exp:gwcode_categories channel="products" style="linear"}
        {if depth1_start}<h3>{cat_name}</h3>{/if}
    {/exp:gwcode_categories}
</div>
</li>

but it pulls only 2 first parent (root) categories from 12 categories assigned to the products channel.

Any clue?

3
  • Are there more than two parent categories? That template should only be showing parent categories as written now, but, your wording is ambiguous as to whether there are 12 categories all together, or 12 parent categories. Jan 17 '14 at 21:18
  • 12 parent and 36 all together Jan 17 '14 at 21:35
  • Well, it looks like I have "parent" which doesn't have a child category after 1st parent category. Is there any way to apply some kind of rule for that one? Jan 17 '14 at 21:39
1

Not quite sure from the comments above if all your 'parents' are on 1 level or not but perhaps this will help

<li class="submenu-parent">
<a href="#">Product Type</a>
<div class="submenu cf" id="submenu-1">
    {exp:gwcode_categories channel="products" style="linear" depth="1"}
        <h3>{cat_name}</h3>
    {/exp:gwcode_categories}
</div>
</li>

This will list all categories from the top level only. It seems like your just trying to make a bunch of h3's with the parent categories in them. If this is not what you are trying to do maybe try listing out your categories on here like

category 1
  category 1.1
  category 1.2
category 2
  category 2.1
  category 2.2
    category 2.2.1
    category 2.2.2

and then explain more specifically what it is you would like to do while referencing the category numbers.

1
  • Thanks for the tip with adding depth="1" to the gwcode_categories tag, Jan 20 '14 at 20:30

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.