19 Nov 2007 by  No Comments    Posted under: Gadgetry and IT

Importing to WordPress from a text file

rss-to-wordpress.gif

I had a website of football reports which was managed by a homebrew flat-file database, and it really needed dragging into the 21st century and being managed by WordPress, or something like that. But how to transfer the hundreds of entries, with all their dates and categories? It turned out to be surprisingly easy, assuming you can export from your database in a specific, user-defined format.

Wordpress has a whole list of import filters (see the “Manage” tab), each dedicated to a specific format. One of these is “RSS”, which takes an RSS feed and converts it into WordPress posts. That’s the one you need. Here’s the procedure:

1. Create your WordPress blog, which – when new – should have one sample entry.

2. Export this to RSS, using Manage > Export. This will give you a “Wordpress RSS format” file, which gives you the template you’ve now got to recreate from your old database. If the database can’t be set up to export a file which looks like that, consider exporting it however you can and using some intelligent search-and-replace procedures to add in all the extra material required.

3. Import your file to WordPress using Manage > Import! I’d try it with just a couple of entries until you get it right, because if it’s wrong, you’ll have to delete what you’ve added, and mass-deletion of entries in WordPress is a real chore.

One notable exception which I discovered is that categories do not transfer if you just copy the exported RSS file you’re using as a template. For some reason, in the sample template file, the post category gets surrounded by “CDATA”, like this:
<category><![CDATA[my category name]]></category>
If you recreate that in your database export file, the categories get ignored. But remove the CDATA part, and everything is fine! The category entries in your file should simply look like this:
<category><my category name></category>

Anyway, here’s my new WordPress-powered football reports blog! The 150 or so entries up to 10 November 2007 were all imported from my old FoxPro database.

Got anything to say? Go ahead and leave a comment!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Looking for stuff to buy? Try these...


Me Tweet quite a bit

This blog really has been going a long time, hasn’t it?

Read the old stuff on this natty calendar thingy

November 2007
M T W T F S S
« Oct   Dec »
 1234
567891011
12131415161718
19202122232425
2627282930