3

A client asked me to took over his website recently to update on his behalf so the site was produced by a previous developer so I am quite new to Expression Engine.

Only pages with single word can show the active menu colour (background + border) when we are on the current page but not other pages with two words.

Heres the code:

<a href="{site_url}team" {if embed:title=='Our Team'}class="active"{/if}>Our Team</a>
<a href="{path='services/taxation'}" {if embed:title=='Taxation'}class="active"{/if}>Taxation</a>

I found that one word would work fine but not two words. I tried:

Our Team
Our%20Team
Our-Team
Our_Team

Any suggestion? Thanks heap!

  • I'm guessing the title is not what you think it is. What is output to the HTML source if you add this to the template? *{embed:title}* (please include the asterisks) – Derek Jones Sep 3 '18 at 18:37
1

It should work. Did you tried:

{if "{embed:title}" == "Our Team"} class="active" {/if}
| improve this answer | |
  • Indeed I have done that one but it did not work. – Vee Aug 21 '18 at 1:39
1

Can you use the url_title instead ?

| 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.