Migrating from BlogCFC to WordPress

Using WordPresses’ RSS import, I was able to copy every post from blogCFC easily. WordPress expects a local file when doing so. And blogCFC’s rss feed is limited to 15. To override that, edit file ‘blog.cfc’. It will be in the following path under your blogCFC installation: /org/camden/blog/. Just set arguments.params.maxEntries to something very very high. If you have less than 1500 posts, the following will do (starting at around line 742):

<!--- Right now, we force this in. Useful to limit throughput of RSS feed. I may remove this later. --->
<cfif (structKeyExists(arguments.params,"maxEntries") and arguments.params.maxEntries gt 15) or not structKeyExists(arguments.params,"maxEntries")>
	<cfset arguments.params.maxEntries = 15>
<cfset arguments.params.maxEntries = 1500>

Then, reinit your session to refresh the blog’s cache. Then go to your feed’s url with your web browser. You should have every single article there. Save that rss as a local xml file. Upload that file into WordPress. Great!

But comments are not copied. So I made and used the below script to copy all post comments from blogCFC to WordPress. Not too difficult! 10 minutes tops.

First, prep the blogCFC database. In the tblblogentries table (where blogcfc keeps the blog posts), add a column named ‘wpid’. For each row, enter WordPresses’s ID of the same post. I had 43 entried so it did not take a heck of a long time. Just sort both tables by title and do it. I suppose you can write a script for this too, but not worth the effort for 43 entries.

With that done, here is the CF code:

<cfquery name="read" dataSource="your-blogcfc-datasource">
SELECT tblblogcomments.*, tblblogentries.wpid
FROM tblblogcomments INNER JOIN tblblogentries ON tblblogcomments.entryidfk = tblblogentries.id

<cfoutput query="read">
	#wpid# #name# #email# #posted# #website#<br>

	<cfquery name="ins" dataSource="your-wordpress-datasource">
	INSERT INTO wp_comments
	(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_content, comment_approved)
	('#wpid#', '#name#', '#email#', '#website#', '#posted#', '#comment#', 1)

Run that page in a browser and all comments are imported! Nice. Then one more step. For each WP post, you have to update the post count. Again, not a big deal. Sort your WP comments table (wp_comments) by comment_post_id and do some simple math.

6 Replies to “Migrating from BlogCFC to WordPress”

  1. Hi nice to hear you convert BlogCFC to wordpress very easily.

    How you import the BlogCFC RSS Feeds because wordpress will ask a local file from computer. Do you used any tools to create a local copy of the RSS Feeds?

  2. Yes, I did use a local xml file. The above article is updated with that information. It required a modification to blogCFC’s RSS CFFunction (around line 742). The modification removes the 15 post limit.

  3. Yes, true, especially for a dedicated CF developer! =)

    But WordPress is so much more refined. The admin, and the whole architecture, is very mature. I was tired of CF driven blogs being so… eh, I donno… not quite being finished products I guess you can say. And I tried several. Some didn’t work. Some sorta worked. It was just frustrating. And I don’t have the time to write my own!

  4. there /is/ a script floating around in the ethernetz that will port from blogcfc to wp2.5 IIRC… or something… I’ve used it on several… then just upgraded my wp install… mind you… it’s been a while, so I’m not sure what changes have been made in blogcfc

Comments are closed.