We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10525
    • 247 Posts
    I need to create a cut-down version of a menu, for mobile.

    It is just a hand-picked subset of 6 pages from the site, from various levels.

    Using &includeDocs=`1, 24, 170, 7, 13, 23` I can display the pages I want, EXCEPT if a page is included without its parent.

    Page structure is like this:
    1
    24
    170

    2
    |_7
    13
    |_23
    I want to include the resources in bold only. But resource 7 doesn't appear in the menu unless its parent, 2, is also included.

    I can't alter hide-from-menu status of any page resource that would impact on other menus on the site.

    How can I include 7 but not 2?

    ___
    modx 2.3.5-pl
    Wayfinder 2.3.3-pl
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You might want to try excluding the ones you don't want using &excludeDocs
        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
        • 10525
        • 247 Posts
        I tried &excludeDocs, but the same applies: if I exclude a parent, all of its children are also excluded, even if they are explicitly included.

        If I use both, eg

        &includeDocs=`1, 2, 24, 170, 7, 13, 23`
        &excludeDocs=`2`

        resource 2 is excluded along with its child 7.
          • 10525
          • 247 Posts
          I also tried

          &where=`[{"id:IN": [1, 24, 170, 7, 13, 23]}]`

          but still the same - no parent 2, no child 7.

          Even if I combine

          &where=`[{"id:IN": [1, 2, 24, 170, 7, 13, 23]}]`
          and
          &excludeDocs=`2`

          I get the same result.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            All I can suggest is to use weblinks or symlinks for the second menu.
              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
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Well, you could use a set of Wayfinder snippets, some with dispayStart and some without.
                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
                • 10525
                • 247 Posts
                This works, but lord what a kefuffle!! With all these built-in knobs and buttons on Wayfinder it would be nice to have one that enabled 'unaccompanied' child docs to be included.

                This is my rowTpl:
                [[+wf.docid:notequalto=`2`:then=`
                	<li [[+wf.classes]]>
                		<a href="[[+wf.link]]" [[+wf.attributes]]><span>[[+wf.title]]</span></a>
                	</li>
                `]]
                [[+wf.wrapper]]


                I'm open to better ways of doing this if anybody knows.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Perhaps &startId=`0` &excludeDocs=`2` &includeDocs=`[[getChildren]]` where you have a simple snippet getChildren that uses the $modx->getChildIds() function.
                    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
                    • 50574
                    • 70 Posts
                    Try PDOMenu if you don't HAVE to use Wayfinder. I had a similar problem and switched to PDOMenu and then simply used
                    [[pdoMenu? &parents=`-1` &resources=`1, 24, 170, 7, 13, 23`]]
                    in the call.

                    This skips the parent resource and shows the sibling at the top level instead. The Menu didn't need to be dynamic this was a good little solution for me.

                    Otherwise, there were some other posts in my question that might help you with a Wayfinder solution here https://forums.modx.com/thread/97349/wayfinder---show-lower-levels-on-certain-menu-items-but-not-others#dis-post-526496
                      • 3749
                      • 24,544 Posts
                      Have you tried a custom parent Tpl chunk that's either empty or has a br tag in it?

                      &parentRowTpl=`MyParentRowTpl`
                        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