Conditional tags for list item?
-
I’m further editing the site I’m working on, and have come across another issue I can’t seem to solve.
What I would like is to have a list menu based upon categories (which I have successfully completed just fine). However, I need a conditional statement so that the link for the parent category page you are on is highlighted.
For example, if you are on the “Articles” page – or any subpage of that category – I’d like a class to be set for that parent’s LI item. So the code would look similar to this:
<li>Home</li>
<li class="active">Articles</li>
<li>Resources</li>As you can see, the “Articles” page would be highlighted. If you move to, say, the “Resources” page, the “Resources” link would have the class assigned to the LI tag, and the “Articles” would revert back to the default.
Is there a way to accomplish this?
- The topic ‘Conditional tags for list item?’ is closed to new replies.