WordPress MU (3.0+) and Thesis Theme

I’m running a WordPress MU (3.0+) installation for a cluster of websites and the Thesis theme works great out of the box.  Unfortunately, you need to hack Thesis up a little if you want the sites to have unique styles.  After searching around for a little, I stumbled on Kristarella’s awesome WPMU + Thesis tutorial.  Exactly what I was looking for.  It only involves changing a few lines of code in the functions.php file (found in your Thesis theme home directory) and allows you to then customize the style for each of your WordPress blogs.  I highly recommend you check out her tutorial and other excellent Thesis how-tos.

There were two changes I needed to make to Kristarella’s code because

  1. I didn’t want to use blog names (I used blog domain*) for the subdirectories, and
  2. I’m using Thesis 1.8 which has some slightly different syntax compared to version 1.7 and below.

So here’s the 3 things I changed in /wp-content/themes/thesis_18/functions.php (which varies only slightly from her guide):

Change this line:

define('THESIS_CUSTOM', STYLESHEETPATH . '/custom');

by tacking on a variable (we’ll define $blog later) so that it looks like this:

define('THESIS_CUSTOM', STYLESHEETPATH . '/custom' . $blog);

Next, find this line:

define('THESIS_CUSTOM_FOLDER', get_bloginfo('stylesheet_directory') . '/custom'); #wp

and add $blog to the end here as well:

define('THESIS_CUSTOM_FOLDER', get_bloginfo('stylesheet_directory') . '/custom' . $blog); #wp

Finally, define $blog at the top of the file (N.B. do this at the very top of functions.php, right below the intro comments) like this:

$blog = "/" . str_replace("/", "", substr(get_bloginfo('url'),7));

[Basically, what I'm doing here is removing the 'http://' as well as any trailing slashes.  Then I'm adding a leading '/' so that it plays nicely when it gets concatenated with the other two strings above].

Save that file, and create sub-directories beneath /wp-content/themes/thesis_18/custom for each of your domains that you’re running (e.g. /wp-content/themes/thesis_18/custom/example.com , /wp-content/themes/thesis_18/custom/examplepart2.com).  Another note on this, is that depending on what you put in Site URL under Settings > General in the WordPress admin, you may need to include a “www.” in front of your domains.

Copy over everything from the custom directory into each of these new subdirectories, and before you go, don’t forget to chmod each of these like you do each time you do a fresh Thesis installation!  Set the cache directory to 775 and layout.css to 666.  And don’t blame me if you kill your sites.

*Only do this if you are mapping domains to unique blogs.

HTML Displaying With Price In Magento 1.4.x

After upgrading to Magento 1.4.x, you may notice “<span>…</span>” HTML tag being displayed around price information within the “Additional Information” section on product pages.  This is a known bug introduced in the most recent releases of Magento.  While it will probably be fixed in the next release, who wants to wait around for that?

To fix this bug, fire up your text editor and open /app/code/core/Mage/Catalog/Helper/Output.php, then add the following to the end of the “If” statement on line 106 (Magento 1.4.0) or line 123 in later versions:

 && ($attribute->getFrontendInput() != 'price')

This will ensure that the <span> disappears.  Now back to work.

HOWTO: Set Default Timezone in PHP

Setting your default timezone in PHP is a very easy task and may be needed for some applications.  If you fall into this bucket, all you need to do is….

  1. Open up your default php.ini file (or the one you wish to edit).  I can help you find your default php.ini file, if you don’t know where it is.
  2. Find the line that says ;date.timezone
  3. Uncomment that line by removing the semi-colon, then set it equal to the appropriate timezone.  For instance:
    • date.timezone = America/New_York
  4. Save the file and restart Apache

In case you’re wondering… I write these how to’s to help me remember.  Might not be so helpful for everyone else, but maybe.