Hello,
So I have a dynamic sidebar navigation with a certain channel’s entries, and I’m trying to figure out how to add class=‘current’ to the current page’s navigation item.
Here’s what I have:
<ul>
{exp:channel:entries channel="products" dynamic="off" orderby="title" sort="asc"}
<li}><a href="http://{path=products/{url_title}}">{title}</a></li>
{/exp:channel:entries}
<ul>I thought I could add a class for the current page by using the {url_title} tag, like this:
<li {if segment_2 == '{url_title}'}class="current"{/if}><a href="http://{path=products/{url_title}}">{title}</a></li>But that didn’t work, I assume because the URL Title is parsed after the if statement.
Can you suggest a way of making this work? Thanks!