Sean’s Obsessions


  • I'm a happy Linode customer. This is a Linode 540 VPS. Linode periodically increases RAM and disk while keeping costs steady, which makes them the natural choice.
  • Archives

18 Jan

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;
}

?>
<MTEntries lastn="999999">
Redirect Permanent /blog/archives/<MTEntryTitle dirify="1">-<MTEntryDate format="%d%m%y">.html   <?=$base?>/<$MTArchiveDate format="%Y/%m/%d"$>/<?php echo sanitize_title("<$MTEntryTitle encode_php="qq" $>"); ?>/
</MTEntries>

Redirect Permanent /blog/index.xml  <?=$base?>/feed/
Redirect Permanent /blog/index.rdf  <?=$base?>/feed/

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

<MTArchiveList lastn="999999" archive_type="Monthly">
<?
$link = preg_replace("/^http:\/\/.*?\//", '/', "<MTArchiveLink>");
?>
Redirect Permanent <?=$link?> <?=$base ?>/<$MTArchiveDate format="%Y/%m"$>/
</MTArchiveList>

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.

Leave a Reply

© 2012 Sean’s Obsessions | Entries (RSS) and Comments (RSS)

Powered by Wordpress, design by Web4Sudoku, based on Pinkline byGPS Gazette