Awesome WordPress Feature of the Day: Add Theme Support

My favorite new function in WordPress is Add Theme Support.

As a developer, one of my favorite things to do is write reusable code. I love when I start a theme and find it needs some bit of functionality that I wrote for something else, if all i need to do is include a file and make a couple strategic edit my job just got easier. Here is a quick example. Imagine you have a custom post type for events ( just an example, I have no code to back this up, sucks I know). If you create your event post type in a class, you can use the current_theme_supports method to check and see if you need it, and your class does the rest!

if(current_theme_supports('event-post-type')){
add_action("init", "jmh_event_post_init");
}
function jmh_event_post_init() {
global $event_class;
$event_class = new event_post_class();
}

So if you build a lot of themes, set up a single folder with an init file. include all your files there, organize it, then your functions PHP will just need to start off with a couple things:

add_theme_support('event-post-type');
require_once('your init php file');