We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16594
    • 8 Posts
    Hi

    Working on my first modx job. It’s all going fine apart from the navigation. I’m trying to figure out how to have the menus display a highlight depending on the page that is displayed.

    I’ve got a horizontal wayfinder main menu. When viewing the homepage I want the ’Home’ link to have a different background image. About page ’About’ link etc. How do I apply a class to the menu dynamically.

    Also I’ve got a couple of sub menus within the site. These are just simple links in a chunk that you select in a template variable. How could I assign a class to these dynamically to have the menu highlight again to the page it’s displaying.

    Thanks in advance.
      • 20288
      • 132 Posts
      The &activeParentRowTpl parameter will be your friend.
      The activeParentRowTpl template is used on the parent, grandparent, etc.. of the current item. The template is applied all the way up the document tree.
      Taken from: http://www.muddydogpaws.com/development/wayfinder/parameters.html
        • 16594
        • 8 Posts
        I finally noticed that Wayfinder generates class="active" so I just used that in the end.

        I made a second Wayfinder call which pulled in just the children for the side menu.