Sean’s Obsessions

Sean Walberg’s blog

Is This Thing On?

People who have been here before might recognize a change – I’ve moved to WordPress 2.0 as I threatened to do earlier.

The change wasn’t that bad, but it wasn’t without its fun.

I installed Word Press into DocumentRoot/blog2, and imported my old Movable Type data.

While testing this, I noticed that comments weren’t coming over. After further investigation, I found that they were in the database, but the wp_posts table keeps track of the number of comments and it wasn’t being updated. Before writing my own script to fix it, I found that someone had already beat me to it, so I used that one.

The theme itself is something I’ve been playing with over at CCSA Certification. I initially started off rolling my own, but it’s a lot of work! While the template system in Word Press is quite easy to understand, there’s a lot to do in order to make a complete template system. So I found one on the ‘net, and modified it to do what I needed.

A lot of my traffic is from search engines, so I wanted to redirect traffic to the new page. the MT Redirect page on the Word Press Wiki gave me a good start, but it didn’t use the same page naming I did, nor did it do category or date archives, nor feeds. The final template I used was:


header('Content-type: text/plain');

$base = "http://ertw.com/blog";

function sanitize_title($title) {
$title = strtolower($title);
$title = preg_replace('/&.+?;/', '', $title); // kill entities
$title = preg_replace('/[^a-z0-9 -]/', '', $title);
$title = preg_replace('/\s+/', ' ', $title);
$title = trim($title);
$title = str_replace(' ', '-', $title);
$title = preg_replace('|-+|', '-', $title);
return $title;
}

?>

Redirect Permanent /blog/archives/-.html /<$MTArchiveDate format="%Y/%m/%d"$>/"); ?>/

Redirect Permanent /blog/index.xml /feed/
Redirect Permanent /blog/index.rdf /feed/


$cat = preg_replace("/.*cat_(.*).html/", '$1', "");
$link = preg_replace("/^http:\/\/.*?\//", '/', "");
?>
Redirect Permanent /category//


$link = preg_replace("/^http:\/\/.*?\//", '/', "");
?>
Redirect Permanent /<$MTArchiveDate format="%Y/%m"$>/

I tossed this in the .htaccess file that Word Press generated and tested a few links. (It’s pretty easy to search and replace the output of this when it’s in the staging area, in my case, blog2)

I haven’t done much for plugins, other than using Hash Cash. Incidentally, the main driver for me to move to Word Press was that there were a few Captcha plugins out there to reduce spam, but as it turns out, Hash Cash is supposed to be better.

Comments

I’m trying something new here. Talk to me on Twitter with the button above, please.