How to Import b2evolution Posts to Wordpress

38

Posted by cmb | Posted in Site Stuff | Posted on 27-05-2007

Tags: , ,

There already exist PHP scripts that can import b2evolution databases into a Wordpress blog, but I personally did not find them to be a satisfactory solution. This is due to the fact that the version of the PHP script you require depends critically upon both the version of b2evolution you are running and also the version of Wordpress into which you are importing (the script has currently not been updated in nine months and is incompatible with all recent b2evolution installs). Additionally it is necessary to install b2evolution and Wordpress into the same database, which is not easy if you are, for example, importing your posts into an already existing blog, or moving site entirely. Finally I don’t really understand databases and as such don’t feel happy in running a script I found on the internet to make massive changes, since if something goes wrong I do not stand a chance at fixing it.

Here I present a method that should work on all versions of Wordpress and all relatively recent b2evolution installs. You will not need to mess around with databases since we use an alternative approach. We are going to skin b2evolution in such a way that if you look at the source of a webpage it appears in a simple format that Wordpress can import, the Movable Type ASCII export format. With no further ado here are the three easy steps you need to perform to move your posts and comments from b2evolution to Wordpress:

1. Apply a new skin to b2evolution

BACKUP YOUR CURRENT SKIN. I’m not responsible if you forget to do this and then change your mind about moving over. Copy the following files over your current theme:

replace _main.php with the contents of _main.php.txt
replace _feedback.php with the contents of _feedback.php.txt

If you now view the blog in a browser it will look like a bit of a mess, but if you view the source of the page (click View > Page Source in your browser) it is in Movable Type ascii export format, which you can import directly into a new (or old) Wordpress install!

2. Download your old blog to text files

I found that the easiest way to grab a whole lot of posts at once was to view the archive page for a whole year, with the display of comments enabled. For example if your blog resides at http://www.mydomain.com/blog/ then the page that will show you all of the posts and comments for the year 2007 is at:

http://www.mydomain.com/blog/index.php?m=2007&c=1

View the source of this page (View>Page Source in your browser) then copy and paste it into a text file. Repeat this step for every year of posts you need to import.

3. Import the text files to Your New Blog

Wordpress

New versions of Wordpress can import directly from the admin control panel, just click “Manage>Import>MovableType and TypePad”. Upload your text files and click import. Older versions of Wordpress already have well written instructions on this page.

Typepad

I have heard that this works, but do not know how to do it…

Bugfixes For Older Software Versions

b2evolution 0.9.0

“author()” isn’t recognized by this version (or at least, the blog I am working with), but if it is replaced with “Author->prefered_name()”, everything works out fine! (thanks Layne)

Questions, comments and criticisms are, as always, welcome below.