WordPress Plugin: Template Provisioning
Overview: What does it do?
*** WARNING: VERSION 0.2 OF THIS PLUGIN REQUIRES WORDPRESS 3.0 ***
The Template Provisioning plugin automatically links to stylesheet and javascript files in your theme directories based on the template file that renders a page. It searches in several pre-defined locations for files, and includes whichever files are found.
I wrote this plugin because I prefer this method to using WordPress’s conditional tags in my header. Keeping resources for different templates separate helps me keep my custom theme directories clean and organized.
For example, if I have a custom template “map.php” that is being used by a static page, I can create “css/map.css” and “js/map.js” files and they’ll be automatically linked-up by this plugin.
Requirements
Will it work with your theme? Probably. It’s completely additive, and doesn’t change anything that would affect other plugins. I have been using most of this code since WordPress 2.5 or so. But be warned… I haven’t thoroughly tested it across versions of WordPress. I’ll try to do that soon and post the results.
Download
Installation
- Download and extract the plugin files.
- Move the ‘template-provisioning’ folder into your ‘/wp-content/plugins/’ directory.
- Activate the plugin through the WordPress Admin ‘Plugins’ page.
- Modify your theme, per the usage instructions below.
Usage
Using the plugin is easy. Just create some .css and .js files where the plugin expects them… in the same directory as your template files. There are a series of files that it looks for when rendering a page using any given template file:
Stylesheets for “<template_name>.php”:
included in page <head> by wp_head() function
- css/global.css
- css/ie/global.css
- css/<template_name>.css
- css/ie/<template_name>.css
Javascript files for “<template_name>.php”:
included in page <head> by wp_head() function
- js/global.js
- js/<template_name>.js
End-of-page Javascript files for “<template_name>.php” footer:
included near the </body> tag by wp_footer() function
- js/global.footer.js
- js/<template_name>.footer.js
Frequently Asked Questions
Coming soon… as soon as somebody starts asking questions.
License

The Template Provisioning WordPress plugin by Jason Tremblay is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
Tech Support
I actually use this plugin, so I’m eager to know if you find any problems with it. Please post questions and suggestions in the comments below, and I will try to address them in a timely manner.
Works great, thank you
Can I use this plugin to enable javascript google adds? If so, how do you suggest I do so.
Thanks
No Gravity Dance
I don’t think this plugin will help you enable javascript google ads. I’m guessing that you need to copy and paste a script tag into one of your templates.
Or, check the WordPress plugin repository… looks like there are some plugins there that are meant to enable google ads:
http://wordpress.org/extend/plugins/search.php?q=google+ads