On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Ok, I'm not sure whether the issue is with Articles, pdoMenu or the Wordpress import!

    I have created a blog in a new website using Articles. The navigation in the website is run by pdoMenu. Initially, I added a dummy article and from what I remember the navigation worked fine, ie. the article does not appear in the drop-down menu.

    Next, I imported a large number of blog posts from the client's current Wordpress blog, using the export to .xlm and Import Articles from Wordpress method which ran smoothly. However, now suddenly all of my articles appear as sub-menu items in my navigation, leading to a very large drop-down menu!

    I have tried to exclude the Articles resource from the pdoMenu call with &parents=`0,-10` (the Articles container is resource 10) but whereas that does remove the Articles dropdown, it also stops all other sub-menus from generating which is obviously not what I want.

    Then, I tried adding &showHidden=`0` even though that should be the default anyway but it does not solve the issue.

    As I mentioned, I think this only happened after I imported from Wordpress - so could that process have overridden the default "hidden" status of the articles that were imported??

    Any advice appreciated.

    This question has been answered by spackko. See the first response.

    [ed. note: intandem last edited this post 4 years, 5 months ago.]
    • can you post your pdoMenu call?

      try to replace it for trouble shooting with this one:

      <!-- Testpattern for pdoMenu -->
      
      [[pdoMenu?
      	
      	&parents = `0`
      	&level = `2`
      
      	&cache=`0`
      
      	&tplOuter = `@INLINE <ul[[+classes]]>
      	[[+wrapper]]
      	</ul>`
      	&tpl = `@INLINE <li[[+classes]]><a href="[[+link]]" [[+attributes]]>[[+menutitle]]</a>
      	[[+wrapper]]</li>`
      
      
      	&tplParentRow = `@INLINE A`
      	&tplParentRowHere = `@INLINE B`
      	&tplHere = `@INLINE C`
      	&tplInner = `@INLINE D`
      	&tplInnerRow = `@INLINE E`
      	&tplInnerHere = `@INLINE F`
      	&tplParentRowActive = `@INLINE G`
      	&tplCategoryFolder = `@INLINE H`
      	&tplStart = `@INLINE K`
      
      	&firstClass = `1`
      	&lastClass = `2`
      	&hereClass = `3`
      	&parentClass = `4`
      	&rowClass = `5`
      	&outerClass = `6`
      	&innerClass = `7`
      	&levelClass = `8`
      	&selfClass = `9`
      	&webLinkClass = `10`
      
      ]]
      


      that gives you placeholders where you can check if something is missing.
        CONIN Werbeagentur . Köln
        http://www.conin.de
      • This is my pdoMenu call:

        [[pdoMenu?
            		&parents=`0`
            		&level=`3`
        		&outerClass=`menu`
        		&parentClass=`sub-menu`
        		&hereClass=`current-menu-item`
        		&showHidden=`0`
        ]]


        Have tried your code above but it has not thrown anything up really, just that the Articles menu item shows as a parentRow but really it shouldn't? I've even tried to untick the "Container" box in Articles but that still doesn't make a difference.

        I also just tried to replace the pdoMenu call with a Wayfinder call but the same thing happened. Which makes me think it must have something to do with the way the Wordpress blog was imported??? [ed. note: intandem last edited this post 4 years, 5 months ago.]
        • strange. chache checked?


          have you access to your database?
          check modx_site_content. there you can see if your settings are correct.

          you can check the children of resource 10

          select id,hidemenu from modx_site_content whre parent=10


            CONIN Werbeagentur . Köln
            http://www.conin.de
          • Thanks, really appreciated. I will check that out (need to wait until the morning - have to do some Skype training with a client now shortly ...). But must definitely have to do with the import - just added another dummy article manually and it does not appear in the navigation. So it's a bug in the import for sure.
            • discuss.answer
              if you manually set an article to 'hide from menu' - does that work?

              If so, you can update your database:
              (if the Articles container has id 10)

              update modx_site_content set hidemenu=1 where parent=10;
                CONIN Werbeagentur . Köln
                http://www.conin.de
              • Skype session postponed...

                Just took a look and those files all have Hidden set to 0. Changed one of them to 1, cleared cache and it has disappeared from the drop-down! Whoohoo!

                Can I be bold and ask you if there's a command to change all of those under parent resource 10 to hidemenu=1? Don't have mysql skills sad

                • try batcher package
                    CONIN Werbeagentur . Köln
                    http://www.conin.de
                  • This should do it:


                    $docs = $modx->getCollection('modResource', array('parent' => 10));
                    
                    foreach ($docs as $doc) {
                        $doc->set('hidemenu', '1');
                        $doc->save();
                    }


                    Batcher will also do it, but it will toggle hidemenu, so any you've done manually will be undone.
                      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
                    • Actually just got it sorted with
                      update modx_site_content set hidemenu=1 where parent=10
                      although I had to do it without the semi-colon from your line above. Absolutely delighted! Was tearing my hair out. Thank you all so much!