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

    I have a rather basic nested-ul menu, which uses CSS to show/hide currently hovered submenu. I want to be able to exclude the Children of a certain page from the menu (children of the page "weblog"). I couldn’t find a parameter for this (such as excludeChildrenFrom or something...). Did I miss it or is this not possible?

    Thanks!

    Best,

    Steven
      • 22427
      • 793 Posts
      Unchecking the "Show in Menu" option for the children of the weblog page doesn’t do it?
        • 28554
        • 201 Posts
        Quote from: ottogal at Oct 11, 2010, 07:23 AM

        Unchecking the "Show in Menu" option for the children of the weblog page doesn’t do it?

        Well, technically yes, but it’s not very friendly for my client to have them do that, I’d much rather have them not worry about these sorts of things...
          • 28554
          • 201 Posts
          Quote from: StevenLangbroek at Oct 11, 2010, 12:45 PM

          Quote from: ottogal at Oct 11, 2010, 07:23 AM

          Unchecking the "Show in Menu" option for the children of the weblog page doesn’t do it?

          Well, technically yes, but it’s not very friendly for my client to have them do that, I’d much rather have them not worry about these sorts of things...

          Any thoughts anyone?
            • 22427
            • 793 Posts
            You could use the parameter [tt]&excludeDocs[/tt] and try to determine its value by [tt]PHx[/tt]
            (with something like [tt]:if=`[*parent*]`:is=`ID-of-weblog-page`:then=`[*id*]`[/tt] as conditions).
              • 28173
              • 409 Posts
              I'm looking for a way to don't insert a class "parent" to a <li> in this precise case :

              • it has children, but they all have the option "not in the menu"
              • even so it's a container

              It's existing the parameter &parentClass : CSS class for menu items that are a container and have children.
              But if all children are "not in the menu", the parentClass is set (and I don't want!!)

              Any idea ?
                • 22427
                • 793 Posts
                Hi Spheerys,
                it's just now I found your post to this old thread. Did you solve it?

                You could try to write a snippet named "MyParentClass":
                <?php
                $output='parent';  // this is the default value of &parentClass
                $numChildren=$modx->resource->hasChildren();
                // Array of all children that have Hide From Menus checked: 
                $hiddenkids = $modx->resource->getMany('Children',array('hidemenu'=>'1'));
                if !( count( $hiddenkids ) < $numChildren ) {
                    $output = '';
                };
                return $output;
                Then put this property in your Wafinder call:
                &parentClass=`[[MyParentClass]]`
                [ed. note: ottogal last edited this post 13 years, 2 months ago.]