
Thesis Hive: Multiple Thesis Sites, One Set of Files
I have two regular blogs running Thesis and one development blog also running Thesis. Each blog has about a dozen plugins in common.
Updating WordPress, the plugins, and Thesis is a pain as it is, so you can imagine how I feel about updating everything three times.
For WordPress and the plugins the solution is WP Hive which lets you use one set of source files for multiple sites. Each site gets its own settings and themes. Each site gets its own set of .htaccess and robots.txt files.
WP-Hive doesn’t let you create your own set of Thesis customizations for each set. The problem is that Thesis isn’t a theme so much as a framework and, if you like using the Thesis framework, then you’re probably going to want to use it for all of your sites each with its own set of customizations.
You can get around this by uploading Thesis multiple times renaming the Thesis theme folder each time. But if you’re lazy like me you’re not going to like updating each Thesis installation every time a new release comes out. Luckily there is a much more simple and elegant solution that makes updating and maintaining your blogs easily.
Add this code to your custom_functions.php file in your WP Hive enabled WordPress installation.
function thesis_hive() {
// Get the correct host name
$hostname = $_SERVER['X_FORWARDED_HOST'] == false ? $_SERVER['HTTP_HOST'] : $_SERVER['X_FORWARDED_HOST'];
// Strip any leading or training dots
$hostname = strtolower(trim($hostname, "."));
// Strip the www prefix
if (substr($hostname, 0, 4) == "www.") {
$hostname = substr($hostname,4);
}
//custom css
if ( ! file_exists(THESIS_CUSTOM . '/' . $hostname . '_custom.css') ) {
fopen(THESIS_CUSTOM . '/' . $hostname. '_custom.css','w+');
}
echo '<link rel="stylesheet" href="http://www.'.$hostname.'/wp-content/themes/thesis/custom/' . $hostname. '_custom.css" type="text/css"/>';
//custom_functions.php
if ( ! file_exists(THESIS_CUSTOM . '/' . $hostname . '_custom_functions.php') ) {
fopen(THESIS_CUSTOM . '/' . $hostname . '_custom_functions.php','w+');
}
if (file_exists(THESIS_CUSTOM . '/'.$hostname.'_custom_functions.php')){
include(THESIS_CUSTOM . '/'.$hostname.'_custom_functions.php');
}
}
add_action('wp_head','thesis_hive');
This will code will automatically create a new set of custom.css and custom_functions.php file for each site the first time someone visits the site after adding the code and link or include the files.
Your custom folder will look like this:
cache/
custom_functions.php
custom.css
hostname1.com_custom_functions.php
hostname1.com_custom.css
subdomain.hostname1.com_custom_functions.php
subdomain.hostname1.com_custom.css
hostname2_custom_functions.php
hostname2_custom.css
etc…
Use the main custom_functions.php file for functions you want to use in all of your sites and the hostname_custom_functions.php file for functions that are specific to that one site.
The various custom.css files can be used the same way.
Final Notes
One drawback of this approach is that calling the functions within Thesis limits the scope. I don’t think you’ll be able to use WordPress functions and WordPress hooks in the hostname_custom_functions.php files. This hasn’t been a problem for me, but you should be aware of it when implementing a Thesis hive.
Thanks to Alex Tran in the comments who mentions a thread in the Thesis forums about creating multiple Thesis image rotators with WP Hive. My Thesis hive script doesn’t allow for multiple image rotators so, if that’s important to you, then go check it out.
Finally, if you have multiple Thesis sites, then you really should have a Thesis Developers License.
You can leave a response, or trackback from your own site.


[...] Thesis Hive: Multiple Thesis Sites, One Set of Files | Damon Gudaitis (tags: thesis thesiswp wordpress wphive hive multiple sites files) [...]
Great idea/post to use site-specific styles and functions.
I also use WP-Hive to manage multiple installs and ran into the problem of site-specific rotator images.
I posted a solution in the Thesis forums if you’re interested.
http://bit.ly/i2VQL
Alex,
Thanks for the link. I only use the rotator on one of my sites so it wasn’t a problem that occurred to me, but the script I posted here doesn’t allow for multiple rotators.
WP Hive should be able to handle different types of multi-media boxes. By should I mean I haven’t tested it, but anything stored in a database gets handled properly by WP Hive.
[...] original post here: Thesis with WP Hive: Multiple Sites, One Set of Thesis Files Tags: thesis Comments0 Leave a Reply Click here to cancel [...]
[...] Be-Hive!: friend Gudaitis (@damongudaitis) explains how he created a Thesis Hive to control his binary sites – enthusiastic for those with the Thesis Developer’s [...]
Glad I found this post. I’m researching how to run multiple wordpress blogs and this looks like a great solution. I’m hoping this will let me have different looking blogs with just one wordpress install.
This is great information for managing multiple blogs. I was wondering if there was a way to run WP Hive and having multiple IP’s for each blog. Seems all blogs will have to run on a single IP under one account.
@James I use multiple IP hosting at work and as far as I understand it, it would be possible to use WP Hive in a multiple IP configuration, but you’d need whoever supplies the IP addresses to set it up.