I’ve developed a small, flexible library to help WordPress theme developers organize their theme files however they like. I came to the conclusion that all the theme frameworks I had used in the past were overkill for my needs, and personally don’t like the idea of parent/child themes. So I created a simple library that would help in organizing themes with numerous files, which was my primary need. But I also wanted to promote OOP over functional coding where possible as well.

I currently use the library on this site (tentatively named ‘Themeo’) and will release an open source version once I’ve tweaked the code for easy configuration. The basic use will be to extend the library, creating a theme-specific class that will encapsulate your theme code.

class MyTheme extends Themeo {

	static public function get_header($file='header'){
		wp_deregister_script('jquery');
		wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"), false, '1.4');
		wp_register_script('app', Themeo::get_template_url() . "js/app.js", array('jquery'), '1.0');
		wp_enqueue_script('jquery');
		wp_enqueue_script('app');
		self::get_template_file('header/' . $file . '.php');
	}
	
	static public function get_sidebar($file='sidebar'){
		self::get_template_file('sidebar/' . $file . '.php');
	}
	
	static public function get_footer($file='footer'){
		self::get_template_file('footer/' . $file . '.php');
	}

}

And then calling your custom class in your theme’s files.

<?php MyTheme::get_header(); ?>


<?php if (have_posts()) : ?>
	<div class="posts">
	<?php while (have_posts()) : the_post(); ?>

		<?php MyTheme::get_template_file('post/loop-item-teaser'); ?>

	<?php endwhile; ?>
	</div><!-- .posts -->

	<div class="navigation">
		<?php next_posts_link('&laquo; Older Entries'); ?>
		<?php previous_posts_link('Newer Entries &raquo;'); ?>
	</div>
<?php endif; ?>
	
<?php MyTheme::get_footer(); ?>

This is a very simple example of how it could be used. More information to come as I get closer to releasing it.