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

    I’ve been working on a snippet/PHP script that will migrate Wordpress post data over to a ModX database. So far I seem to have most of the kinks worked out in testing. I do have some areas that I’m not sure how to handle, though, and I’d like some feedback.

    1) WordPress categories.

    Tags are easy to handle, but I’m not sure about categories. In WordPress, these are simply ’keywords’ which are used to build indexes. You click on CatX, and you get everything with the "CatX" keyword, so to speak.

    In ModX, though, categories would need to be actual documents: parents that contain children. Considering that one post in WordPress can have multiple categories, this is going to be (pardon the language) a bitch to set up. Sure, I could make a blank document and mark it as "isfolder" in ModX, and try to place children underneath it, but as soon as I get a document with more than one category.... ew.

    Any ideas on how to handle it?


    2) ModX "parent" and "isfolder".

    Given the problems with making WordPress content into folders/children/parents, I’m strongly leaning towards just setting "parent" and "isfolder" to "0" in both cases, and let people use Doc Manager to sort it out later. Other suggestions are welcome.

    3) ModX "menuindex."

    WordPress has a menu order variable, but it appears to only be used for pages (not posts), and it isn’t a reliable index. You can set it to *anything* -- 50, 100, 1000 -- with the only result being that the higher numbers are ordered after the lower numbers. This would also work with ModX, I suppose, but it seems messy. Would it be preferable to let the menuindex autoincrement, and people can re-order it later, or respect the WordPress menu order in some manner and go from there?


    Thanks for the input!
      • 26931
      • 2,314 Posts
      Hi spellsmith,
      Tags are easy to handle, but I’m not sure about categories. In WordPress, these are simply ’keywords’ which are used to build indexes. You click on CatX, and you get everything with the "CatX" keyword, so to speak.
      not sure if this is going to be of any help for you, but there’s a little MODx Snippet which can be used to create categories without using folders (in addition to tagging): http://modxcms.com/forums/index.php/topic,37081.msg225154.html#msg225154
        • 20413
        • 2,877 Posts
        1. See http://modxcms.com/forums/index.php/topic,35926.msg217059.html#msg217059
        2. Using isfolder (container) is nice for Ditto etc. when you you want a resource to be
        showing up as a container even though it’s empty.
        3. You can choose to sort your documens by any Document Object or TV, but menu index is nice
        when you build your own menus (manager). It’s hard to be reliable when you have publishers
        editing and deleting.

        //Maybe I should read the post and title before I write replies... tongue
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 28159
          • 22 Posts
          Thanks for the links and input. As an update, I’ve got it mostly working. It’s simple (since it’s made for my blog, which is simple), but it works.

          Only thing I’m still wrestling with is ID conflicts (i.e. you import WordPress document #15, but ModX already has a document #15) and making sure that new id’s are tracked through all the tables correctly.

          Once I have a 100% working beta, I’ll share smiley
            • 27708 MODX Staff
            • 2,502 Posts
            For your migrated content why not prefix the ID with another number such as 1 or 2 where id 15 becomes 115 or 215 granted that would be an issue if you had more than 100 posts.
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 28159
              • 22 Posts
              I found a way to generate new auto_increment IDs for the migrated content and track them correctly through the assorted tables. As far as I can tell, everything works! I’m going to test it a bit more this week, as I suspect I’ll have unpleasant surprises with links and URLs in the migrated content, but I’m pretty darn happy with how it’s working so far.
                • 25663 MODX Staff
                • 12,272 Posts
                It would be really cool to see you package up what you’ve got and to share it in the In Development forum topic so others could either contribute or learn from your experiences. Add in Disqus or Echo and the ping/trackback solution from the Japanese community and you’ve got a MODx blogging platform that’s pretty darned cool!
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 3749
                  • 24,544 Posts
                  Thought I’d mention that in MODx Revolution, there are real categories that can be attached to resources or elements and they are much more tag-like than in Evolution. I think the conversion would be much more straightforward in Revolution.
                    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
                    • 17499 ☆ A M B ☆
                    • 872 Posts
                    That’s interesting BobRay. You mean that we don’t have to create tv based categories with Revolution?

                    Any pointer for that functionality, i can’t see it anywhere.
                      • 33337
                      • 3,975 Posts
                      Quote from: BobRay at Nov 24, 2009, 10:14 AM

                      Thought I’d mention that in MODx Revolution, there are real categories that can be attached to resources or elements and they are much more tag-like than in Evolution. I think the conversion would be much more straightforward in Revolution.
                      BobRay, I dont think categories are available for "Resources" aka Documents. We have to go for TV based categories since a post can be in 2 or more categories.

                      But I have played with Revolution lot less than you ofcourse tongue
                        Zaigham R - MODX Professional | Skype | Email | Twitter

                        Digging the interwebs for #MODX gems and bringing it to you. modx.link