We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40464
    • 1 Posts
    Hi everyone, I'm new to modx and wayfinder. I am currently using the following code for wayfinder

    [[!Wayfinder? & startId=`0` & hereClass=`current` & firstClass=`` & lastClass=`` ]]

    However this produces, for example
    <ul>
    <li class="current">
    <a href="index.php?id=1" title="Home" >Home</a>
    </li>
    <li>
    <a href="index.php?id=2" title="Page2" >Page 2</a>
    </li>
    </ul>

    However, I want it to create
    <ul>
    <li>
    <a class="current" href="index.php?id=1" title="Home" >Home</a>
    </li>
    <li>
    <a href="index.php?id=2" title="Page2" >Page 2</a>
    </li>
    </ul>

    -----------------------

    My understanding is I need to do this with chunks. I tried creating a chunk called "wfHere" that contained
    <li><a class="current" href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a></li>
    [+wf.wrapper+]

    However, this did nothing. I'm not sure if I have to activate the chunk somewhere? I can't find any information on this in the documentation.

    Hopefully someone can help me. Thank you.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There are several chunks used to format each part of the menu. Each one has a property in the snippet call
      [[Wayfinder? &startId=`xx` &level=`xx` &rowTpl=`rowTplChunk`]]
      

      The rowTpl chunk will provide the structure for each row:
      <li [+wf.classes+]><a href="[+wf.link+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>

      Notice the placeholder for classes; this will create a class of "active" for the active page (as well as its parents in the case of submenus) and class of "last" for the last item in the row.

      Also notice that the wf.wrapper is inside of the li structure; this is so that submenus will be properly enclosed.

      Here's a link to a fantastic ebook on using Wayfinder, and I've attached a cheat sheet.

      https://forums.modx.com/thread/40293/new-wayfinder-e-book?page=11#dis-post-398834
        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