We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11858
    • 130 Posts
    I have a structure which looks like this in the manager:

    Press Centre
    |
    --- Stories
    |
    --- Downloads
    |
    --- Images


    When I call to wayfinder, I have the three items in the navigation "stories", "downloads" and "images". I would also like "press centre" to be listed at the top, but it’s not a child document - it’s the parent document.

    How can I add the parent to the top of a wayfinder nav? I want to do this in Wayfinder and not Ditto as I would like the nav to have the .active class applied to it so I can style the navigation.

    Thanks!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      &displayStart=`1` and use a chunk tpl for the &startItemTpl; by default it’s a non-link H2 header.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 11858
        • 130 Posts
        Brilliant thanks Susan.
          • 11858
          • 130 Posts
          I now have another problem that I was hoping I could get some help with!

          I have implemented the template, and all is working well. Only problem is now that all the other pages are child docs of "press centre" so when I navigate to the child pages, "press centre" is always has the .active class applied as it’s the parent.

          I rely on this feature in other places in my site so I don’t want to remove it. The only solution I can see is to move the content of "press centre" to a child document and make "press centre" redirect to the child document. I don’t really want to do this as it will mess up my friendly URLs, effectivly mydomain.com/press will be empty and redirect to mydomain.com/press/contentofpresscentre or something like that which isn’t ideal from a SEO point of view either.

          Is there a way to make the page only .active when you’re actually on that page and not a child document of that page?
            • 11858
            • 130 Posts
            I’ve been bashing my head against this problem for a few hours now and have gotten nowhere. =(

            My wayfinder call is:

            [!Wayfinder? &startId=`15` &level=`1` &sortBy=`menuindex` &sortDir=`ASC` &outerTpl=`tplNavOuterTags` &displayStart=`1` &startItemTpl=`tplNavTopItem`l!]
            


            in tplNavOuterTags I have:
            [+wf.wrapper+]
            </ul>
            


            and in tplNavTopItem I have:
            <ul><li[+wf.classes+]>
            <a href="[+wf.link+]" title="[+wf.title+]">[+wf.title+]</a>
            </li>[+wf.wrapper+]
            


            This generates the HTML page when on the "press centre" page:
            <ul>
            <li class="active"><a href="/press" title="Press Centre">Press Centre</a></li>
            <li><a href="/press/corporate-social-responsibility" title="Corporate Social Responsibility" >Corporate Social Responsibility</a></li>
            <li><a href="/press/newsletters" title="Newsletters" >Newsletters</a></li>
            <li><a href="/press/events" title="Events and Competitions" >Events and Competitions</a></li>
            <li class="last"><a href="/press/executive-personel-photography" title="Executive Personel Photography" >Executive Personel Photography</a></li>
            </ul>
            


            Which is great, however if you go to say the newsletter page the "press centre" page stays active as it is actually the parent of newsletters:

            <ul>
            <li class="active"><a href="/press" title="Press Centre">Press Centre</a></li>
            <li><a href="/press/corporate-social-responsibility" title="Corporate Social Responsibility" >Corporate Social Responsibility</a></li>
            <li class="active"><a href="/press/newsletters" title="Newsletters" >Newsletters</a></li>
            <li><a href="/press/events" title="Events and Competitions" >Events and Competitions</a></li>
            <li class="last"><a href="/press/executive-personel-photography" title="Executive Personel Photography" >Executive Personel Photography</a></li>
            </ul>
            


            I’ve tried messing around with &activeParentRowTpl and &parentRowHereTpl but that all seems to apply to the children of the parent, and not the template in tplNavTopItem.

            Is there a way to set the template of the &StartItemTpl when you aren’t on that actual page?
              • 11858
              • 130 Posts
              Unfortunately I can’t find a solution to this, so I’ve created the content that’s in www.mysite.com/press in www.mysite.com/press/stories and anyone who visits www.mysite.com/press is redirected to www.mysite.com/press/stories.

              Not ideal, but at a loss as what to do to make it work!

              Cheers

                • 567
                • 8 Posts
                I think I remember reading about ’active’ and ’here’.
                it sounds to me that you want ’here’ instead of ’active’.

                as currently it is behaving properly and showing you the ’active’ path to the document you are on (breadcrumbing).

                try researching ’here’ (&here)?.

                and it may do what you want.

                sorry, no examples.
                  • 4501
                  • 1 Posts
                  Hi,

                  have a look at the &selfClass-parameter. Works fine for me.

                  Regards
                  Christopher
                    • 11858
                    • 130 Posts
                    Hi CalganX

                    I’ve had a look at the parameter, but it doesn’t apply the style to the heading. The heading is always out of the <ul> tag so I have used templates to make it part of the <ul> but the style in &selfclass is not applied to the heading which is displayed by &displayStart=`1` and styled by &startItemTpl=`tplNavTopItem`. The code is in a previous post in this thread.

                    Do you have an example of it working that I might be able to have a look at? I’d be forever grateful if you could post your code and your wayfinder query?

                    Regards
                    Alex
                      • 11858
                      • 130 Posts
                      Ok, I’ve made it work by changing my wayfinder code to:

                      [!Wayfinder? &startId=`15` &level=`1` &sortBy=`menuindex` &sortDir=`ASC` &displayStart=`1` &outerTpl=`tplNavOuterTags` &startItemTpl=`tplNavTopItem` &selfClass=`navigationActive` &hereClass=`` !] 


                      And creating a navigationActive class. Only problem is the parents aren’t highlighted, except the grandparent which is what I was aiming for. It’s a compromise, but one I’m going to live with!

                      Thanks for all your help.

                      Alex.