How-to: Migrate data from WordPress 2.9 to WordPress 3.0(subsite)

This is exactly how I get my original data of cuimengsuo.com back online to cuiziqi.com/cui/en.
My method requires you have an idea of database, a little bit MySQL programming skills, and a DIY-holic spirit.

First allow me to introduce my situation, you know, the context.
1.I’ve been added a new sub site http://cuiziqi.com/cui/en (Thanks to the new WP 3.0, the steps are pretty easy, check out the official guide here. Naming it en ‘coz the posts are in English).
2.and I’ve had a database online where all my previous data of cuimengsuo.com are stored there.
3.Besides, I’ve uploaded all my uploads(/wp-contents/uploads) to my current hosting server(since I already knew that all subsites of WP 3.0 share the same uploads folder, I then uploaded them to that folder as well).

One more thing, a simple look at the database you’ll know that WP will save the all of your new sites’ data in the tables with the prefix wp_2_, like wp_2_posts, wp_2_terms, etc. Besides, further side by side table compare will tell you that which table/data are created by your installed plug-ins, other than WP itself(I assume here your new site are a fresh install until now, like I did).

Now time to figure out what exactly you wanna transfer.
In my case, all I care about is my posts, pages, tags, categories and comments. No links, since I didn’t have many. No user either, since I’m the only author.

Warning: I suggest you do a database backup before start. Log on to your phpMyadmin panel, open two tabs which shows your the old and the new database.

OK,now showtime.

first, the posts and the pages, accordingly the table wp_posts.

1. Modify the old wp_posts table.
>>rename it to wp_2_posts.
>>remove the field post_category, ‘coz there’s no such a field in the new wp_2_posts table accordingly.
>>update the domain name string in the post_content. In my case, from http://cuimengsuo.com to http://cuiziqi.com/cui/en.
update wp_posts set post_content=replace(post_content,’http://cuimengsuo.com’,’http://cuiziqi.com/cui/en’) WHERE instr(`post_content`,’http://cuimengsuo.com’)>0
>>export the data to a zipped sql file and save it to your local hard disk.

2.Modify the new wp_2_posts
>>clear the table
>>uncheck the field ID‘s AUTO_INCREMENT property.

3.Transfer the data.
>>goto the new database and import the data.

4.Enable the new table wp_2_posts.ID‘s AUTO_INCREMENT.

5.Done.
Visit your blog and you should see your posts back.  Great, eh? Not finished yet, let’s move on.

Now comments, obviously the table is wp_comments(I just leave wp_commentmeta out and seems until now everything works fine. but if you think it wrong, please correct me via comments). Most of the steps are similar to what we’ve done in posts actually. Here they are.

1.Update the old wp_comments table.
>>rename wp_comments into wp_2_comments

>>Url replacement in two fields: `comment_author_url and comment_content.
update wp_2_comments
set `comment_author_url`=replace(`comment_author_url`,’http://cuimengsuo.com’,’http://cuiziqi.com/cui/en’),comment_content=replace(`comment_content`,’http://cuimengsuo.com’,’http://cuiziqi.com/cui/en’)

2.Prepare the new wp_2_comments table.
>>do the clear, like we do in the posts;
>>uncheck comment_ID‘s AUTO_INCREMENT.

3.Export the data from old table and then import it into the new one.
4.Restore the new table’s AUTO_INCREMENT.

Last, the tags and categories. They all are in the following tables: wp_2_terms,wp_2_term_relationships and wp_2_term_taxonomy.
Basically the steps are the same: clear data for the new table, disable AUTO_INCREMENT if necessary, do the export and import, finally enable AUTO_INCREMENT accordingly.

All done and enjoy.

A New Theme

I’ve been using whiteasmilk theme on this blog for a long time. I myself do love those kinda simple but classical themes,you know, text-centered, very few colors, eye-friendly fonts etc, just like whiteasmilk.

However, in order to make this blog a little bit ‘holiday’ with the coming long National Day Holidays, I decide to get a new theme for celebration.

That’s why you see Redtopia, my final choice after hours of googling and testing.

The big/small roses are for the country’s 60 birthday. The main red-only color seems just in time for my celebration purpose. So that’s it.

Hope you enjoy it as i do.

WPtouch – The Coolest WP Theme for mobile

Just happened to get this new theme from the admin page by the part of plugins->most popular. After a little bit playground I think it deserves a new post to recommend to my readers.

Official website is here. And the latest version is 1.9.2.2(Thanks to WP for its very charming feature of installing/upgrading the plugin in the admin page directly. Very nice.)

Below is what this site looks like in the iPhone’s safari browser.

cui-wptouchcui-wptouch-2

I don have other mobile devices like gPhone or Blackberry, so don know how it performs in that devices. It does look quite nice at least in the iphone.

Besides, it loads fast and the user experience of the whole ajax-powered interface does make me very satisfied. Not mention its very nice feature of allowing the reader to switch between the regular lookings and wptouch version. Really cool, isn’t it?

I should say, with wptouch, time to say goodbye to my long-used iwphone plugin.

Make WordPress Grey To Mourn Quake Victims

Grey to Mourn Earthquake Dead

The following is the how-to, which is IE only.

Add the following corlored code to your theme’s header.php, right after <header>. Mine looks like this:

<head profile=”http://gmpg.org/xfn/11“>
<style>
     html { filter:gray }
</style>

Or just filter:grey; to your body definition part in the style.css, which has no effect on the looking of  the sidebar. 

Update(May.22,2008): back to normal now. Thanks for your understanding and patience.

Comment Email Responder and iWPhone

If you are looking for an WP plugin by which your reply to the comment on your blog will be automatically sent to the comment owner, you know, to keep you and your valuable reader connected, then Comment Email Responder is just for you.

Comment Email Responder

Another is iWPhone, by which your wordpress blog will be more iphone-friendly. Here’s what my blog looks like. Nice, eh? Can’t wait to get it? ok, visit here for downloading and installation instructions.

my iwphoned blog

Both free plugins work pretty well in my blog. I love them so much. And very appreciate the authors’ good work and love to give them a big thumb up - http://www.cool-names.net.

OpenID Enabled

openid

I love OpenID, ‘coz i do think it’s the future of the mechanism of authentication and authorization. The more you learn about it, the cooler you will think it is. No wonder why so many big companies are chasing it now, including google,yahoo and microsoft.

And i’ve tried several times to make my site support OpenID by installing some found plugins. but all failed.

Until today i’ve figured it out finally. If your site is powered by the latest wordpress 2.3.2 and you wanna openid, here’s how:

1. install this plugin(by now, it’s version 2.1.2);

2. modify the \openid\Auth\Yadis\Yadis.php according to this comment. as said, remove the “=null” part. that is, from the italic one to the bold one:

function discover($uri, &$fetcher = null,
$extra_ns_map = null, $timeout = 20)

function discover($uri, &$fetcher,
$extra_ns_map, $timeout = 20)

3. now activate the plugin and enjoy.
You can just ignore the warning in the setting page of the plug if you still get it.

BTW, I use PHP 4.

And i encourage you to get your own openid from either myopenid.com as i did or any other providers listed here or spreadopenid. ‘Coz if you do and you wanna leave a comment here, your comment will be shown immediately and no awaiting needed as usual. At least as a piece of cake  😉

Update: It doesn’t work https so far. see my testing comment. If you know other openid plugins for wordpress, please share with me. Thanks.

Update(Jan.18,2008): Now yahoo has choosed to join openid too.

I’ve Got Friendly URLs Here!

I know it’s built-in feature in WP 2.3.1. However, due to i haven’t direct control on the server where my site is hosted in, this plan has to be postponed.

Until tonight i found this very valuable article. Exactly what i wannt: no loss to the traffic and smoothly upgrade to the more SEO-ed url pattern by redirecting.

Cool!