Movable Type 3.34 to WordPress 2.8.4

As you can see, I have moved my blog over to WordPress. Actually, the whole domain, ZackVision.com, is powered by WordPress.

If you see any problems, please comment on this post or contact me.

I was using Movable Type 3.34 which came out in January 2007 and was now badly outdated. The reason why I hadn’t upgraded is because I was using a lot of hacks and had made my own modifications to the core code.

A few months ago, I ran into major problems with spam comments. That got me thinking about an upgrade. I was, however, able to solve the spam issue with MT-Akismet.

I downloaded Movable Type 4.2, the latest version, and played around with it. I liked it, but I realized that none of the plugins I was using had an upgrade for MT4. Also, I could find very few amateur bloggers on Movable Type. Professional websites and blogs were mostly using Movable Type, but the rest of the bloggers had switched to WordPress long ago.

I had already been using WordPress for a private blog and so I decided to take a look at the latest version of WordPress and how I could migrate my blog to it.

There were a few things I had to give up: No more MathML or serving all pages as application/xhtml+xml; no OpenPGP signed comments.

I also had to modify the Movable Type export script and WordPress’s import script so I could keep the same post IDs and slugs (basenames) as well as import tags and convert the content based on the text filter used in Movable Type.

Here are changes required in Movable Type 3.34’s lib/MT/ImportExport.pm file:

--- ImportExport.pm.orig        2009-09-23 11:25:12.975789000 -0700
+++ ImportExport.pm     2009-09-23 11:25:12.764003000 -0700
@@ -529,27 +529,27 @@
     $tmpl->text(<<'TEXT');
 AUTHOR: <$MTEntryAuthor strip_linefeeds="1"$>
 TITLE: <$MTEntryTitle strip_linefeeds="1"$>
+BASENAME: <$MTEntryBasename$>
 STATUS: <$MTEntryStatus strip_linefeeds="1"$>
 ALLOW COMMENTS: <$MTEntryFlag flag="allow_comments"$>
 CONVERT BREAKS: <$MTEntryFlag flag="convert_breaks"$>
 ALLOW PINGS: <$MTEntryFlag flag="allow_pings"$>
+POSTID: <$MTEntryID$>
 -----
 BODY:
-<$MTEntryBody convert_breaks="0"$>
+<$MTEntryBody$>
 -----
 EXTENDED BODY:
-<$MTEntryMore convert_breaks="0"$>
+<$MTEntryMore$>
 -----
 EXCERPT:
 <$MTEntryExcerpt no_generate="1" convert_breaks="0"$>
 -----
 KEYWORDS:
-<$MTEntryKeywords$>
+<MTEntryTags include_private="1" glue=","><$MTTagName$></MTEntryTags>
 -----
 <MTComments>
 COMMENT:
@@ -558,7 +558,7 @@
 IP: <$MTCommentIP strip_linefeeds="1"$>
 URL: <$MTCommentURL strip_linefeeds="1"$>
 DATE: <$MTCommentDate format="%m/%d/%Y %I:%M:%S %p"$>
-<$MTCommentBody convert_breaks="0"$>
+<$MTCommentBody$>
 -----
 </MTComments>
 <MTPings>

And here are the changes required in WordPress 2.8.4’s wp-admin/import/mt.php:

--- mt.php.orig 2009-05-05 12:43:53.000000000 -0700
+++ mt.php      2009-09-23 11:49:00.182602000 -0700
@@ -375,6 +375,15 @@
                                        $post->post_title = $title;
                                else if ( 'ping' == $context )
                                        $ping->title = $title;
+                       } else if ( 0 === strpos($line, "BASENAME:") ) {
+                               $postname = trim( substr($line, strlen("BASENAME:")) );
+                               if ( '' == $context )
+                                       $post->post_name = $postname;
+                               else if ( 'ping' == $context )
+                                       $ping->post_name = $postname;
+                       } else if ( 0 === strpos($line, "POSTID:") ) {
+                               $postid = trim( substr($line, strlen("POSTID:")) );
+                               $post->import_id = $postid;
                        } else if ( 0 === strpos($line, "STATUS:") ) {
                                $status = trim( strtolower( substr($line, strlen("STATUS:")) ) );
                                if ( empty($status) )

I also added the following to the .htaccess file to handle the redirects needed from my old URLs to the new ones:

RewriteEngine On
RewriteBase /
# Old Monthly archives
RewriteRule ^weblog/archives/([0-9]{4})/([0-9]{2}) weblog/$1/$2/ [R,L]
# Old single entry links
RewriteRule ^weblog/archives/000([0-9]{3}).html$ ?p=$1 [R,L]
# Another old single entry links
RewriteRule ^weblog/archives/entry/000([0-9]{3}).html$ ?p=$1 [R,L]
# Old category archives
# Change underscores to hyphens
RewriteRule ^weblog/archives/([^_]*)_([^_]*)_([^_]*)_(.*)$ weblog/category/$1-$2-$3-$4/ [R=301,L]
RewriteRule ^weblog/archives/([^_]*)_([^_]*)_(.*)$ weblog/category/$1-$2-$3/ [R=301,L]
RewriteRule ^weblog/archives/([^_]*)_(.*)$ weblog/category/$1-$2/ [R=301,L]
RewriteRule ^weblog/archives/([^0-9]*)$ weblog/category/$1/ [R,L]
# To handle the old MovableType feeds.
RewriteRule ^weblog/atom\.xml$ feed/atom/ [R,L]
RewriteRule ^weblog/index\.xml$ feed/ [R,L]
RewriteRule ^weblog/index\.rdf$ feed/ [R,L]
# To handle old Movable Type permalinks.
RewriteRule ^weblog/([0-9]{4}/[0-9]{2}/.*)\.html$ $1/ [R,L]

I liked the iNove theme and installed it with some modifications done via child theme.

I have also installed the following plugins:

  1. About Me widget
  2. Akismet
  3. AmazonFeed
  4. AVH Amazon
  5. Collapsing Archives
  6. Contact Form 7
  7. Easy AdSense
  8. Efficient Related Posts
  9. Google Analyticator
  10. Google XML Sitemaps
  11. Lifestream
  12. NextGEN Gallery
  13. Now Reading Reloaded
  14. Page Links To
  15. Recommended Reading: Google Reader Shared
  16. Rich Text Biography
  17. JanRain RPX – Authentication from Facebook, Twitter, Google, Yahoo, Windows Live ID and OpenID
  18. Search & Replace
  19. Search Meter
  20. Sociable
  21. Thread Twitter
  22. WP-Syntax
  23. XML Google Maps

I am also working on a fork of Now Reading Reloaded. It will be for movies and will be called Now Watching. Once I have tested it, I’ll release it here and on the WordPress site.

While the blog itself has been completely moved over to WordPress, I am still working on migrating the other static pages. Also, my list of books read and movies watched is still not back yet.

By Zack

Dad, gadget guy, bookworm, political animal, global nomad, cyclist, hiker, tennis player, photographer

11 comments

  1. Thanks for this. Your mod for ImortExport.pmp seems to work beautifully. Actually, all the other info on doing that I have found seems to be horribly out of date so it was great to find you here.

    BUT

    For some reason, the import part on the WP side doesn’t seem to be working. I’ve edited my mt.php file but the post IDs don’t seem to carry over.

    Just in case I have made a mistake in editing mt.php it would be cool if you would post the entire edited file so hacks like me can just replace the one that came with WP with your version.

    I don’t think I made a mistake. Is it possible that there is a difference between what you did and what needs to be done in WP 2.8.5 ?? …unlikely.

    Any suggestions?

    Thanks.

  2. Crap. My bad. I still had “ID:” instead of “POSTID:” …An unintentional hybrid resulting from trying tons of different versions of editing ImportExport, most of which seem to be entirely obsolete.

    Still though, it would be cool if you had a link to the entire files’ source code so peeps like me who are doing this thru FTP don’t have to deal with those Plus Signs Etc.

    You’re great for posting this! Thanks.

  3. Pingback: untell.com

Comments are closed.