Moving from ExpressionEngine to WordPress in 64 easy steps.

I’ve had a lot of requests for a post on how I moved my ExpressionEngine blogs over to WordPress so here it, finally, is. And, no, it doesn’t really take 64 steps.

The problem with moving from EE to WordPress is that while WP has an impressive selection of importing tools for various platforms built into it, ExpressionEngine isn’t one of the supported platforms. This means we have to do it ourselves and so that’s what I set out to do. You will find in the ExpressionEngine Wiki some information on how to export to the MovableType Format, but this has a couple of limitations that made it less than ideal. For example, I used the SolSpace Tags module in ExpressionEngine and wanted to move all the tags over to WordPress, but the MT format has no facility to do that. A much betterĀ  solution would be to export to WordPress’s native WXR format which does support tags, but finding info on how the WXR format is defined (it’s an extension of XML) was more difficult than I thought it would be. It doesn’t appear anyone has sat down and specifically posted what WordPress looks for and accepts in an WXR file.

Eventually I set up a test blog in WP, put in some content that hit all the features I wanted to support, and then did an WXR export to see how the file was set up. I’m far from an expert on the WXR format, but I managed to figure out enough of it to get things to work. My method is similar to the aforementioned MT export templates except that it outputs WXR formatted data instead. You can download the templates by clicking here.

To use them you’ll want to create a new template group called “export” in ExpressionEngine. Then create two RSS templates in that group to hold the templates themselves. I called the first one “export” and the second one “comments.” It doesn’t really matter what you call the first one, but the second one must be named comments so it’ll be embedded properly. If you change the name then be sure to change it in the first template file. Both templates should be set in EE as RSS pages and you should set Allow PHP to “Yes” and “On Input” on the comments template. In the first template on the very first line is the global variable {assign_variable:master_weblog_name=”yourblogshortname”} which you should change to the short name for your blog in EE.

Once you’ve done all of that you’re almost ready to start exporting data. I use the word almost because there’s one thing that I can’t account for ahead of time and that’s the amount of data you are exporting and what RAM limits your server has. There’s also the fact that these templates do not save out to a file. Instead you have to right click on the “view” link in EE’s template listing and select “open in a new tab/window” then click on that new tab and select “show page source” which will open another new window, and then save that new window’s output to an XML file.

Doesn’t matter what you call the files (I named mine SEB1.xml, SEB2.xml, etc.), but if you try to output all of your data at once and you have a crap load of it then your browser will probably crash before you can save the file. On top of all of that, WordPress has a import size limit of 10MBs per file. In the case of SEB, at the time I made the move, I transferred some 6,500+ entries and 75,000+ comments and there was no way in hell it was all going to come out as one great big file so I ended up having to do multiple exports.

Here’s how you do that: In the first template file there’s a line that reads as follows:

{exp:weblog:entries weblog="{master_weblog_name}" dynamic_start="on" limit="9999" offset="0" sort="asc" rdf="off"}

The two key parameters are the limit and offset. The limit sets the total number of entries that’ll be included an in export and the offset tells it at what entry to start at. If you have a very small blog (couple of hundred entries with less than a dozen comments each) then you might be able to get away with a single export using those settings, but if not then here’s where you will have to experiment to find out what you can get away with and it will depend on how many entries you have as well as how many comments on those entries. There is a similar line in the comments template which limits how many comments to include that is set to 1,000 comments. None of the entries on SEB ever hit 1,000 comments so that worked just fine for me, but if you have entries with more than 1,000 comments you may need to edit that template as well. Due to memory limitations on my server I found that I could only export between 100 and 300 entries at a time before EE would abort with an out of memory error. This meant that I ended up exporting some 32 files total to get everything moved over. If I got an out of memory error then I’d go in and change the limit to a smaller number (usually decrementing by 50 each time) until I got a successful export. Once it was successful I’d go back in and change the limit back to 300 and increase the offset by however much the last export put out. Do that as many times as you need to to export all your data.

If that sounds like a pain in the ass, well, it is, but there’s still more that can go wrong. Because you’re generating an XML file your browser can be pretty fucking picky about any weird or garbled characters that might happen to be in your code. SEB was originally on MovableType and in the move from that to ExpressionEngine there were a few entries that ended up with some non-standard characters in them. Whenever an export hit one of those garbled characters it would cause an XML error and I’d have to try and figure out which entry was causing the problem, edit it in EE to fix the garbled characters, and then retry that particular export. I’d say there was about a dozen entries or so that caused me fits, but if you’ve been running on EE all along then this probably won’t be a problem for you.

Now for some good news: WordPress is impressively good at importing those WXR files. If you screw up and forget to change the offset number and end up with a duplicate file (or just one that has a handful of duplicates) WordPress will NOT create duplicate entries in your database. It’ll report those as duplicate entries and reject them. WordPress will also ask you how to handle entries written by people other than the account you are logged in as when doing the importing. You can either reassign those entries to an existing WP user or you can have WP create accounts for those users when doing the import. WordPress is also just fine with importing one file after another to build up your database back to normal.

Some other things to keep in mind with these templates: They make the assumption you’re using the default field names of {body} and {extended} for your blog entries. I also didn’t include {summary} as I never used it myself so you’ll need to add that in if you want it. The code I used for exporting Tags is not included because not everyone uses that module, but I can supply it if you want it. One other thing I should have done and didn’t think of until after I was finished was adding in code to check if the {extended} field existed and if it did to put in the WP code for a Read More link. So for SEB, all the entries where I had a body and extended section became one big posting under WP. If you’re at all comfortable with making EE templates then you should be able to look at these, see how I did things, and tweak them according to your needs.

That’s pretty much the process in a nutshell. Hopefully this isn’t too confusing. If nothing else it should give you a starting point if you want to make the transition yourself. Perhaps someone else will come up with an even better way to do it. Feel free to ask me any questions you have in the comments.

Testing out WordPressMU.

So I’m playing around with the multi-blog version of WordPress to see how it works out. I had installed just a single copy of the stand-alone WordPress first and that worked just fine, but I’m a little worried about WordPressMU. Not because it’s not working, but because I can’t find where it put the database tables.

I’ve got one database on this hosting account, but that’s not a problem because the different CMS systems prepend their tables with unique identifiers so they stay separate. When I installed the stand-alone WP I could see the tables were marked with WP_ so when I removed it I just dropped those tables. When I installed WPMU it was supposed to do the same thing, but no new tables are showing up in the DB. Yet it’s working. Color me confused. So this post is basically to say that if you notice anything wonky happening to drop me a note and let me know. So far EE appears to be completely unaffected, but you never know.

On the plus side the MU version of WordPress works pretty well and allows for a decent amount of control over what blogs set up under it are allowed to do. One unknown at the moment is whether or not it allows you to use distinct domain names for blogs you’re hosting. It assumes you’ll be using subdomains and that’s fine for some of my blogs, but my mother’s (among others) have their own domain name. Ultimately it’s a toss-up if it’d be better to go with the MU version or just install separate instances of the stand-alone software. It would certainly make keeping track of spam and such across the various blogs, but they would be limited only to the themes and plugins I make available to them. Which may or may not be a bad thing.

At this point I’m leaning in the direction of making the switch. WordPress has come a long way since the last time I played with it and a lot of the features it was missing are now available either in the core or as plugins. I think ExpressionEngine is moving more and more away from blogging and into full-blown CMS territory and it does that very well, but as a blogger I’m feeling a bit left behind. I’d still like to see what EE 2.0 has to offer, but unless I’m blown away I’ll probably be making the switch. The hard part now is converting the 10,000+ entries across 12 blogs (some of which are admitted defunct at this point) over to WP. Not to mention the nearly 78,000 comments in SEB alone. WP has a shitload of importers for all manner of blog systems… with the exception of EE, natch. I suppose I could just start from scratch for SEB and just worry about converting the smaller blogs, but I’d hate to do that. And I still have to decide whether to do stand-alones or go with WordPressMU. I’m sure I’ll be debating it for some time to come. Hopefully EE 2.0 will release more info soon so I can factor that into my decision.

SEB entries will now be twittered.

I finally got around to setting up the ExpressionEngine LG Twitter extension by Leevi Graham. This means it should automatically tweet my twitter account with any new entries I publish. It also puts a nifty little Twitter box at the bottom of every control panel page so I can tweet at a whim while working on an entry.

My one concern is that I don’t think it shortens the URL for the entry and SEB’s can be quite lengthy as can the titles I choose. So between the title length and the URL length, it’s quite possible that I’ll exceed the 140 character limit and twitter will ignore it. As it stands now there’s 63 characters left after the first part of the URL is accounted for. Still, it’s better than nothing so we’ll see.

Update: I was wrong. Looks like it does shorten the URLs. Yay!

Defensio Combo anti-spam module now available for ExpressionEngine.

The guys at Hop Studios have just released version 1.0 of their Defensio Combo module for EE. We’ve been testing it for awhile here at SEB and I’m happy to say that I like it better than Akismet. It makes use of the Defensio Anti-Spam service which not only learns from spam and flags it for moderation when it suspects a comment fits the bill, but also keeps track of how well it’s doing on your site and provides you with RSS feeds for tracking moderated comments.

It works more or less similarly to Akismet, but it gives a bit more control over how things are handled and a bit more feedback on how it’s doing. The guys at Hop Studios have been very enthusiastic about the development of this module and are looking to add even more features in the future (I’ve recommended an option that ignores comments from registered members). The module is free for use by anyone running EE 1.6.x so if you’re curious to see what it’s like then go download it and give it a whirl.

Testing out Defensio anti-spam system.

Justin Crawford of HOP Studios has created a new anti-comment spam module combo for ExpressionEngine that makes use of the Defensio service and we’re giving it a go here at SEB. It’s similar to Akismet in most respects, but gives a little more control over how comments are handled. So for the moment I’ve disabled Akismet and enabled Defensio and we’ll see how it goes. We get a fair amount of comment spam here so it shouldn’t be too long before we know if it works better or worse than Akismet.

As always, let me know if anything looks wonky or doesn’t work.

SEB is beta testing the Tag 2.0 module.

Just upgraded the installation of the Tag module from 1.16 to 2.0 beta this evening. One of the big changes is that there is no longer a need for a custom field for tag input as there is now a Tag tab along the top of the entry editing screen which you can click on to input tags when submitting posts. One nice thing about it is that it will suggest tags from the already existing tags so you can avoid using similar, but slightly different tags.

As always this is beta software so if you see anything funky happening drop me a note..

SEB now running on ExpressionEngine 1.6 and Forum Module 2.0.

Just a quick note to let folks know I’ve upgraded our installation of ExpressionEngine to the latest and greatest version along with the forum module, which few people ever use. For those folks who are interested the full change log for this version can be read here. Most of the changes are under the hood bug fixes and improvements that won’t be immediately obvious, but there’s several new features including a new Pages module that allows for the creation of static-like pages in your blog for things that aren’t really an entry. Things like the “About” tab in SEB’s menu bar which I still haven’t actually created a page for, but which I probably will now just to try out this new module.

The changes should be largely transparent, but there’s always the chance that a glitch or two will pop up here or there so if you notice anything funky or not working quite right then drop me a note and let me know and we’ll see what we can do to get it fixed.

SEB members can now edit their comments after submission.

ExpressionEngine coder extraordinaire Paul Burdick has answered some long standing feature requests with a nifty new plugin that allows members to edit their comments after they’ve already submitted them. This plugin is called, oddly enough, Edit Comments and it does its magic using AJAX to keep things simple.

I’ve already added it to the templates here with a time limit of 60 minutes to make your changes in. This is to allow you to correct your “oh shit” mistakes that you noticed after hitting the submit button, but I don’t want comments to be editable forever. Right now the comment box it puts up is kinda small for my tastes so I’ll look into seeing if I can enlarge it, but it seems to work so try it out and let me know what you think.

Comment pagination is back. Sidebar link should still work.

Elwed dropped me an email with a solution to the comment links in the sidebar when using paginated comments problem so I’m trying it out. This means that the comments pages are once again limited to 25 per page to help speed up page rendering on the bigger threads. The sidebar recent comment list should still link directly to the comment regardless of which page it’s on. I’ve also updated the All Comments links to take advantage of the same solution.

The solution takes advantage of the fact that EE doesn’t really care what comment you start pagination with so we just stick a query in that counts the number of comments in the thread up to the one we want to link to and then we build a link with the pagination set to that number and it starts with that one and any other comments that come after it.

It’s pretty clever actually and I feel kinda stupid for not thinking of it myself.

Big thanks to Elwed for being more clever than I am.

pMachine changes name to EllisLab and launches a shiny new site design.

The company that make ExpressionEngine,  the blogging package I use to run the various blogs including SEB, have changed their name from pMachine Inc. to EllisLab:

Six years ago we released our first product, a web publishing program called pMachine. At the time it seemed logical to call the company pMachine as well since our entire business was based on that product.

Since then we’ve grown, expanded our product line, and broadened our focus. Today, EllisLab is about creating cool products, incubating bright ideas, and building relationships that help our customers succeed on the web.

The new website is pretty cool and has reorganized everything to make finding stuff a lot easier. For example while there was a central repository for plugins there wasn’t one for extensions, but now there is and it’s easy to find. You’ll also find information on their EngineHosting service (the place SEB calls home) as well as their freely available CodeIgniter PHP framework.

All in all it’s a wonderful update to the site and makes finding out more about ExpressionEngine and what it offers a lot easier to do. Go check it out.