We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29597 ☆ A M B ☆
    • 350 Posts
    So I have this menu created with Wayfinder and it includes a news page (using Articles)

    I am able to show the last 3 items using the following call (from https://www.markhamstra.com/modx-blog/2012/2/listing-articles-posts-getresources-wayfinder/):

    [[Wayfinder?
        &startId=`0`
        &level=`3`
        &outerTpl=`flex4_main_nav_outerTpl`
        &innerTpl=`flex4_main_nav_innerTpl`
        &outerClass=`top-bar`
        &innerClass=`dropdown`
        &parentClass=`has-dropdown`
        &ignoreHidden=`1`
    ]]
    


    The '&ignoreHidden' works and now it shows the last 3 posts, but what if the user wants to hide normal resources using '&ignoreHidden'?

    How do I get Wayfinder to show the latest 3 Articles in the menu without losing the '&ignoreHidden' functionality

    BONUS QUESTION!

    My Wayfinder call adds a class of 'has-dropdown' for menu items with children...
    This also happens for the Articles menu item even if I do not include '&ignoreHidden'
    So It shows the <li> item for the news as having children, but does not show any children.

    How do I get Wayfinder to NOT assign the Articles li item a '&parentClass' while keeping the 'active' class when on the News page(I need the [[*isfolder]] set to 0 for the Articles container template) [ed. note: ThaClown last edited this post 13 years, 2 months ago.]
      MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
      DESIGNfromWITHIN, MPThemes and Any Screen Size
      Follow me on Twitter | Read my blog | My code on GitHub
      • 44567
      • 23 Posts
      I doubt that the call above will give you the last 3 items only. I think you meant &limit=`3` instead of &level, right?

      If you want to ignore normal resources, &where is the way to go. For example:

      [[!Wayfinder? ignoreHidden=`1` &startId=`0` &excludeDocs=`54` &where=`[{"template:!=": "3"}]`]]

      This is for one of the 404 pages in one of my projects. Template #3 is one that is for a series of objects that a customer can edit, in this case a menu with loads of delicious dishes smiley I don't want those to be displayed, because they're all technically not HTML content but a lot of TVs, such as image, description, name, price, etc.

      The where clause keeps those from showing in the wayfinder tree. You can use it with pretty much anything. In your case, you can adding the articles container to &excludeDocs and customizing the where clause to anything that uses the articles template.

      That should work.
        • 38290
        • 712 Posts
        I wonder if you could use &where to say classKey is modArticle and hidden is true OR classKey is ! modArticle (and show both hidden and not hidden)
          jpdevries
          • 29597 ☆ A M B ☆
          • 350 Posts
          Thanks guys, I learned some stuff but am not there yet.
          The problem is that my Template is installed with a package and I have no idea what the ID of the news page (if even used at all) will be...

          I solved the part of not showing Aricles posts like mentioned here: https://forums.modx.com/thread/72608/solved-wayfinder-showing-all-posts-in-articles-nav
          But I still get the Articles container menu item listed as having children in Wayfinder.

          The Articles container resource has the [[*isfolder]] (the 'Container' option under settings for other resources) set to 1 and I need 0...
            MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
            DESIGNfromWITHIN, MPThemes and Any Screen Size
            Follow me on Twitter | Read my blog | My code on GitHub
            • 44567
            • 23 Posts
            Quote from: ThaClown at Jul 23, 2013, 02:28 PM
            The Articles container resource has the [[*isfolder]] (the 'Container' option under settings for other resources) set to 1 and I need 0...

            That's the way to go. I still didn't understand completely what you want to do, but here's a more generic approach, which you are going to need anyways smiley

            Find the common denominator of ALL posts that you want to EXCLUDE. If you can't do it with a Wayfinder call, take a look at getResources. Also very powerful, and you can pretty much do the same with it, if you put some work into it and split your requests up a little.

            But in a nutshell: Find, what all posts have in common, apply the where-clause accordingly and you should be fine.
              • 29597 ☆ A M B ☆
              • 350 Posts
              Thanks for the explanation, but it is not what I need.

              My current call already excludes all the sub articles from the 'News' menu item:
              [[Wayfinder?
              &startId=`0`
              &level=`3`
              &outerTpl=`flex4_main_nav_outerTpl`
              &innerTpl=`flex4_main_nav_innerTpl`
              &outerClass=`top-bar`
              &innerClass=`dropdown`
              &parentClass=`has-dropdown`
              &categoryFoldersTpl=`flex4_main_nav_categoryTpl`
              ]]
              


              Setting the Link Attributes of the 'News' Articles container to 'rel=category' allows me to use a different rowTpl 'flex4_main_nav_categoryTpl':
              <li[[+wf.id]][[+wf.classes]]>
              	<a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>
              </li>
              


              Now the children of 'News' are now excluded from Wayfinder, the 'News' item still gets a class of 'has-dropdown' from the &parentClass...
              I can remove the [[+wf.classes]] tag, but this will also remove the 'active' class from the 'News' item.

              I need a way to have the 'News' Article container resource to NOT get 'has-dropdown' from the &parentClass
              For any other resource you can simply un-tick the 'container' option, but this is not available for the Articles container.
                MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
                DESIGNfromWITHIN, MPThemes and Any Screen Size
                Follow me on Twitter | Read my blog | My code on GitHub