Thesis Master Custom Functions for WordPress Multisite Networks

The Thesis WordPress theme framework gives multisite developers the ability to use one theme folder to manage unlimited blogs on the network. Using a modification to the Thesis Core, you can use separate custom folders each site, allowing you to make different customizations, and theme settings. This modification adds the ability to make global changes to any site on the network, using one file.

** If you haven't enabled WordPress Multisite, or made the Thesis Modifications, read this first, and come back.

Video: WordPress + Thesis Multisite Domain Mapping Network Installation

Different Multisite Uses

Multisite is useful for a number of scenarios. For one client, it is the perfect solution, giving each location a separate blog all on the same site. In this case, I didn't make the Thesis modification, because it's one website, with one theme throughout.

For my own websites, and some clients, I'm installing WordPress Multisite with Domain Mapping to allow for administration of multiple domains through one WordPress installation, and one control panel. But what if I want some elements to be consistent through the network, like whitelabeling WordPress?

Network Wide Custom Functions

I know what you're thinking. "Just copy the functions into each custom_functions.php". Yea, well that's kind of redundant now isn't it? I'd rather just have one file to do the heavy lifting that needs to done on each site.

We can take it even farther. What if I want to have one file containing all my functions, and call them in each site's custom_functions.php file as needed? Now we're making progress!

Implementing this is incredibly simple, yet opens up so many possibilities for developers.

Step 1 – Create your Directory and Master Custom Functions File

First, create a directory in the Thesis folder named master_custom. This will contain your network functions file, and any others you chose to use throughout your WordPress network.

You can name the file what you like, such as network_custom_functions.php, or wobbly_headed_bob.php. The name isn't important, just make sure you use the correct filename in the next step.

Step 2 – Require Your New Master Custom Functions File

Were really going to save some code here. Instead of your 2000 lines of functions you have crafted and saved since you started using Thesis, we will have one line accessing them all for each site.

Simply paste this line into each custom_functions.php file in your network.

require_once(TEMPLATEPATH . '/master_custom/master_custom_functions.php');

This will work regardless of what you name your Thesis folder, because it uses the template path to access the folder dynamically.

Now you can have your library of code in one file for unlimited websites, and keep your custom_functions.php files very clean and manageable.