Let’s say we have a site with four items in a managed menu, corresponding to pages:
Home | Foo | Bar | Baz
The “Home” item is a custom link pointing at “/”.
And we want the “Bar” content shown on the home page, so in Settings, we specify that for the front page.
When visiting the homepage, both “Home” and “Bar” get active classes, resulting in styling(.current-menu-item / .current_page_item
) like:
Home | Foo | Bar | Baz
â¦when it seems reasonable to expect that only Home be highlighted.
Did I do something wrong here, or is this actually buggy(or at least sub-optimal) behavior? And is there a relatively painless way to correct it in templating? I can undo the styling pretty easily with a bit of page-targeted CSS, but it’s a workaround to the actual problem and I’m curious if there’s something I’m missing in the theming.
This is actually intended and accurate behaviour, it just isn’t desired for your specific use case.
To put it another way, when you click on bar, by your logic home should not be active, but it will be, because home and bar are the same page, with the same URL. Thus what you want is ambiguous.
Instead I recommend you download and install the Spots plugin. Create a new Spot with the content from the bar page, then insert that spot into the bar page. Finally, create a page called Home, and set that as the frontpage, and hey presto, home != bar and the menu works as desired, but they both show the desired content.