0

I'm trying to create a navigation with my categories, current the categories look like this:

Products

– Accessories

– Backpacks

– Clothing

– – Mens

– – Womans

When on the main products page I want to display all of these items, when on the clothing page I want to display Clothing as the title, then Womens and Mens, when on Mens, I want to display Mens and Womens with Clothing as the title. Currently have the following code:

{exp:gwcode_categories cat_url_title="{segment_3}" show_trail="yes" class="categories"}
      <a href="/cave/category/{cat_url_title}">{cat_name}</a>
    {/exp:gwcode_categories}

This is outputting the current item you're on and any parents items above, I just need to display the siblings as well (women if you're on men).

Is this possible? and if so, how, thanks!

  • can you use the tag a second time to display just the children? – mjr Sep 16 '13 at 19:04
1

Embeds...

Primary Template:

{exp:gwcode_categories cat_url_title="{segment_3}" limit="1"}
    {embed=Xgroup/Ytemplate parent="{parent_id}"}
{/exp:gwcode_categories}

Secondary Template (group Xgroup, template Ytemplate):

{exp:gwcode_categories cat_id="{embed:parent_id}" incl_self="no" show_trail="yes" class="categories"}
    <a href="/cave/category/{cat_url_title}">{cat_name}</a>
{/exp:gwcode_categories}

You could output the current category in the primary template, then pass through to the embed the cat_id which could then excluded in the secondary template.

The primary could also be used to display the parent category details (if exists).

The alternative would be to use something like Stash to avoid the embed and save the parent and utilise it in a second gwcode_categories call after the first.

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.