As mentioned before, we are in the process of evaluating Wordpress as a candidate for our future blogging platform. This evaluation includes importing all information from the current blog to the possibly new one.
Wordpress offers several ways to import data from another system. There are plugins for the major blogging platforms like Blogger, TypePad, LiveJournal and Wordpress that can be found in the Wordpress admin under Tools - Import. You can also search for
importer or
import to find more plugins.
Since Wohill is not put on any of these blogging platforms but instead is self-developed we can not use any of these plugins. However, there is a tool that can be found in the same place that allows importing from an RSS-feed. Since Wohill has a validated RSS-feed, this is what I have used. Worth mentioning is that I have downloaded Wordpress which means that data tables are created in the same database as the one we use today. What I want said by that is that it is possible to copy data from the old data tables to the new ones without the RSS-importer. But since it exists and importer it is easier and we will use it.
It worked fine. The basic information gets in there. I had problems with the author though. I tried using the author-tag and the dc:creator-tag but neither worked. This was however solved by manually setting the author using SQL-queries in PHPMyAdmin after the import.
The RSS-import only imports posts and we still have comments, tags etc. to take care of and I don't want to add them manually. There might be a plugin that works for this as well but I solved it this way to get the comments in and associated with the right posts.
Since the data tables from the current and the new platform resides in the same database we can use some SQL to fix this. I used the following to copy the comments from the old comments table to the new.
# Insert comments INSERT INTO wp_comments (comment_author, comment_author_email, comment_author_url, comment_content, comment_date, comment_post_ID, comment_approved) SELECT a.name, a.email, a.website, a.body, a.publishDate, b.ID, '1' FROM old_comments_table a inner join wp_posts b on (a.postId = b.guid and a.approved = '1') |
The comments get in there and also associated with the right posts. The comment count on the posts has not been adjusted though. I searched the web and found a for this. Use this code straight off as it is and this issue will be taken care of as well.
# Update comment count on existing posts UPDATE wp_posts wpp LEFT JOIN (SELECT comment_post_id AS c_post_id, count(*) AS cnt FROM wp_comments WHERE comment_approved = 1 GROUP BY comment_post_id) wpc ON wpp.id=wpc.c_post_id SET wpp.comment_count=wpc.cnt WHERE wpp.post_type IN ('post', 'page') AND (wpp.comment_count!=wpc.cnt OR (wpp.comment_count != 0 AND wpc.cnt IS NULL)); |