Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-10-27 22:31:24

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Getting if_article_category to ignore children of a category

I’m using if_article_category to style the sidebar sub-navigation of a site as active or not. For example, when you are on the rats page, “Rats” is highlighted in the navigation:

Rodents Mice Rats Gerbils
Canines Dalmatians Beagles
Felines
Fish
Birds

Problem is, if you’re on the page that uses the parent category, all the children are also highlighted. For example (on the “Rodents” page):

Rodents Mice Rats Gerbils
Canines Dalmatians Beagles
Felines
Fish
Birds

How can I get around that? I’m not using ?category, so if_category isn’t an option for me here.

Never mind – I just realized it’s because the items are nesting in a group – changing the structure of the HTML should fix this. I’ll update if I still need help.

Last edited by frickinmuck (2011-10-27 22:42:08)


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#2 2011-10-27 22:47:38

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Getting if_article_category to ignore children of a category

Assuming you’re using nested ul li’s in your markup, is your active class actually being added to each child category in the source, or is the css just cascading through to the nested list tags? If it’s the latter, it’s just a matter of explicitly styling ul li.active ul li { font-style: normal; }.

EDIT: you don’t necessarily need to change your html structure.

Last edited by jakob (2011-10-27 22:48:42)


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB