0

My code for GWcode Categories add-on looks like:

{exp:gwcode_categories group_id="4" cat_url_title="{segment_2}" last_only="yes" class="list-plain" class_current="current_category"}
<a href="{path="{segment_1}/{complete_path}"}">{cat_name}</a>
/exp:gwcode_categories}

Based on Nick suggestion I have used GWcode CatMenu add-on

{exp:gwcode_catmenu group_id="4" cat_url_title="{segment_2}" min_depth="2" class="list-plain"}
<a href="{path="{segment_1}/{complete_path}"}"
{if active} class="current"{/if}>
{cat_name}
</a>
{/exp:gwcode_catmenu}

but I have no clue why on current category class is not added.

Thanks

1

Looks like you need the GW CatMenu add-on; class_current isn't listed in the docs for GW Categories.

| improve this answer | |
  • I have try to use that add-on but with that code {exp:gwcode_catmenu group_id="4" cat_url_title="{segment_2}" depth_open="2" class="list-plain"} I'm getting all categories from group 4 instead only child categories whatever is under parent category based on URL. – JackTheKnife Feb 18 '14 at 17:30
  • Please check OP for edits. – JackTheKnife Feb 18 '14 at 17:43
0

As I wasn't able to get GW CatMenu output categories in a way I want, I have decided to go back to GW Categories and use logic below to indicate active/current category:

{exp:gwcode_categories group_id="4" cat_url_title="{segment_2}" last_only="yes" class="list-plain"}
{if "{segment_3}"=="{cat_url_title}"}{cat_name}
{if:else}
<a href="{path="{segment_1}/{complete_path}"}">{cat_name}</a>
{/if}
{exp:gwcode_categories}   
| improve this answer | |

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.