… <ul> <li><a{if segment_1 == ''} class=”nav”{/if} href=”{homepage}”>Home</a></li> <li><a{if segment_1 == 'about'} class=”nav”{/if} href=”{path='about'}”>About</a></li> <li><a{if segment_1 == 'blog'} class=”nav”{/if} href=”{path='blog'}”>Blog</a></li> <li><a{if segment_1 == 'contact'} class=”nav”{/if} href=”{path='contact'}”>Contact</a></li> <li><a{if segment_1 == 'testing'} class=”nav”{/if} href=”{path='testing'}”>Testing</a></li> <li><a{if segment_1 == 'testing_2'} class=”nav”{/if} href=”{path='testing_2'}”>Testing 2</a></li> </ul> …
The class=”nav” is only assigned to the very last entry in the list. How is that possible? I want to create a class for the links in the menu.
Claus
The nav class will only be applied when the condition of your if statements are met.
What you have:
<li>
<a{if segment_1 == 'testing_2'} class="nav"{/if} href="{path='testing_2'}">Testing 2</a>
</li>
To always add the nav
class you need to remove the if statement all together.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.