2

I have an "About Us" section of my website. I am trying to attach current classes based upon the url. When you click on the about us section of the website, it takes you to a channel entry whose url_title is "pastors-welcome", and while on that page, the "about-us" template group index page is displayed, so segment_1 is "about-us" and segment_2 is blank. If you navigate the pages within the about-us template group, the current class displays correctly because segment_2 == url_title, but when segment_2 is blank, obviously no class will be applied. I basically need a conditional that says, if segment_2 == url_title, OR (segment_1 == "about-us" AND segment_2 == "blank") then apply this class. I'm not sure if that's a great explanation, but here's my code:

{embed="embeds/html_header" page_title="{exp:channel:entries channel="about_us"}{title}" {/exp:channel:entries}}

<ul class="categories">
        <a href="{path=about-us}"><h2 class="section-header">About Us</h2></a>
        {exp:channel:entries channel="about_us" dynamic="no" {gv_param_disable_all}}
        <li><a{if segment_2 == url_title} class="current"{/if} href="{homepage}/about-us/{url_title}">{title}</a></li>
        {/exp:channel:entries}
</ul>
1

ok, I figured this one out:

{if segment_2 == url_title || url_title =="pastors-welcome" && segment_2 == ""}

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.