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

    I'm having some trouble trying to use Wayfinder to sortBy for different levels. My code is below and I have it working perfect for my 2nd level submenu but I don't want it to order the first level. How can I assign the sort by to only order the 2nd level?

    [[Wayfinder? &startId=`1` &level=`2` &sortBy=`pagetitle`]]

    Thanks in advance.


      • 22427
      • 793 Posts
      You could try nested Wayfinder calls: An "outer" one (without sorting) just for the 1st level items, with a rowTpl chunk containing an "inner" Wayfinder call for the submenu, where you use the sortBy property.
        • 49891
        • 4 Posts
        Hi ottogal,

        Thanks for the reply, im not having much joy with this. What would I need to use for the rowTpl chunk?
          • 22427
          • 793 Posts
          The "outer" WF call:
          [[Wayfinder?
              &startId=`1`
          	&level=`1`
          	&rowTpl=`rowTemplate`
          ]]
          &level=`1` constrains the output to the top level.

          The chunk rowTemplate:
          <li><a href="[[+wf.link]]">[[+wf.linktext]]</a>[[Wayfinder? &startId=`[[+id]]` &sortBy=`pagetitle`]]</li>
          Here &startId=`[[+id]]` lets WF ouput just the children of the resource of the actual row.
          That's the idea - I didn't try it myself.
            • 46886
            • 1,154 Posts
            I suspect putting it in a <span>[[wayfinder_call]]</span> might be needed in the <li> but I could be wrong.