My new gig at DreamHost comes with a minor ‘d’oh!’ and that is it’s a capital H. Which I seem to be incapable of remembering. So I wrote a function. I stole capital_P_dangit() and swapped the WordPress for DreamHost. To save myself from embarrassment, here it is:
// Capital H in DreamHost
add_option( 'helf_capital_H_dangit', 'yes', '', 'yes');
if ( get_option( 'helf_capital_H_dangit' ) == 'yes' ) {
foreach ( array( 'the_content', 'the_title', 'comment_text' ) as $filter )
add_filter( $filter, 'capital_H_dangit', 11 );
}
function capital_H_dangit( $text ) {
// Simple replacement for titles
if ( 'the_title' === current_filter() )
return str_replace( 'Dreamhost', 'DreamHost', $text );
// Still here? Use the more judicious replacement
static $dblq = false;
if ( false === $dblq )
$dblq = _x('“', 'opening curly quote');
return str_replace(
array( ' Dreamhost', '‘Dreamhost', $dblq . 'Dreamhost', '>Dreamhost', '(Dreamhost' ),
array( ' DreamHost', '‘DreamHost', $dblq . 'DreamHost', '>DreamHost', '(DreamHost' ),
$text );
}
Now. Here’s where it gets fun. No ‘hacks’ posts will be affected by this code! Otherwise how would I show it to you here? Normally this is where you would just run remove_filter( 'the_content', 'capital_H_dangit', 11 ); in the functions file for your theme. Due to the way I’ve wrapped my various functions into mu-plugins, the down and dirty way was to wrap the above block of code with a check for if ( $blog_id != 2 ) { { ... }.
Most of the time you won’t care about things like this. I just needed it so I could demonstrate code. I’ve done the normal filter remove here so I can also say ‘Wordpress’ in my code related posts. For proof this works, I assure you, 100%, that I typed in ‘Dreamhost’ over in my post about quitting my job and going to work for them.
Sorry about that, Simon!

