0

I can't figure out why this conditional does not work. It is a dropdown navigation item in my main nav.

    <ul>
    {exp:channel:entries
        channel="locations"
        orderby="date"
        sort="asc"
        dynamic="no"
        disable="categories|category_fields|member_data|pagination"
    }
        <li{if segment_2=='{url_title}'} class="on"{/if}><a href="{url_title_path='contact'}" title="">{title}</a></li>
    {/exp:channel:entries}
    </ul>

I know segment_2 is the same as the entry's url_title.

Any help is appreciated.

1

Force the conditional to be parsed after the exp:channel:entries module.

<ul>
{exp:channel:entries
    channel="locations"
    orderby="date"
    sort="asc"
    dynamic="no"
    disable="categories|category_fields|member_data|pagination"
}
    <li{if "{segment_2}" == "{url_title}"} class="on"{/if}><a href="{url_title_path='contact'}" title="">{title}</a></li>
{/exp:channel:entries}
</ul>
| 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.