Change CSS class in Wayfinder MODx menu dependent on page template

320 Views Asked by At

I've got a dropdown menu created with Wayfinder in MODx. Basically I'm trying to style specific page links in the dropdown, depending on which template the specific page is using.

So fx. if a page is using template "A", its link in the dropdown gets the class A - and class "A" can be styled.

How would you do this?

I would also like to order the page links in the dropdown, according to their page's template.

Thanks!

Edit:

Basically I'm trying to style specific page links in the dropdown, depending on a template variable I've set up. I've got a TV called [status] which can be set to 1 of 3 radio options when editing a page.

So fx. if a page's [status] is set to "A", its link in the dropdown gets the class A - and class "A" can be styled.

1

There are 1 best solutions below

4
On

Add class to body tag:

<body class="template-[[*template]]">

And then just use it in css like:

.my_wayfinder_menu {
    /* common style */
} 
.template-5 .my_wayfinder_menu {
    /* only for template with id 5 */
}