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

    I’m somewhat new to Modx (proficient in WordPress/Drupal though) and can’t figure out how to automatically sort my sub-menus. I want the main level of navigation to be sorted by its index. You can see an example here: http://stgeorge.md.goarch.org/about/parish.

    I’d appreciate your help, please.

    Thank you all,

    Dinos
      • 3749
      • 24,544 Posts
      By default, Wayfinder sorts menus by menuindex, so you can manually enter menu index numbers when creating/editing the documents.

      It will also sort by any other resource field so if you set

      &sortBy=`id`


      in the Wayfinder tag, it will sort by the document ID.

      &sortBy=`pagetitle`

      will sort alphabetically by title.

      You can also set

      &sortOrder=`ASC`

      or
      &sortOrder=`DESC`
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 4805
        • 5 Posts
        Thank you! Makes total sense - and worked perfectly. Only thing - I want the main top nav to be sorted differently than the sub-menus. For example, I want "Home" to be listed first. Any way to easier do this?

        Thanks again for your help!

        Dinos
          • 15082
          • 195 Posts
          To sort in your desired order, enter the appropriate menuindex (i.e. 1 for home to be the first).
          To sort a bunch of documents use the sort function of DocManager module.

          Greetz
          JUSI
            • 3749
            • 24,544 Posts
            BTW, menu index numbers don’t have to be sequential, so you can assign 9999, for example, to something you always want at the bottom of the menu.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 4805
              • 5 Posts
              This sounds soooo simple, and I set the menu indexes for the top nav 1st level nav from 1 to 5. But, they’re still appearing alphabetical. Can’t seem to get the first level nav to be sorted by menu index and the drop-down menus sorted by alpha.

              What am I doing wrong?

              Thanks again!
                • 4310
                • 2,310 Posts
                If your horizontal menu is being generated by one Wayfinder call you can’t have them sorted two different ways.
                Use menuindex and either change the child documents manually by editing their menuindex number or use the DocManager module to drag and drop them into the correct order.
                  • 4805
                  • 5 Posts
                  Thank you gentleman - much appreciated!!