Toolbox 1.1 is on it’s way with support for two of WordPress 3.1′s new Post Formats — Aside and Gallery — and a new template structure based on a
content.php template. Let’s take a look at what’s new.
So, Post Formats. I love them and I bet if you’re at all interested in WordPress theming you’re probably interested in them too. Toolbox 1.1 will add support for Aside and Gallery posts along the same lines as the new Twenty Ten theme will. If you’re familiar with the Twenty Ten theme you know what to expect. It already mimics this new feature with Categories. Asides have a hidden title on blog pages and Gallery posts have a thumbnail from your post’s gallery along with a sentence letting visitors know how many images are in the gallery. It’s pretty cool.
Now, the Toolbox theme will do all that with Post Formats but it’ll be organizing things a little differently in the next version. The
loop.php template will be disappearing for one. The loop will move back to the template files you’d expect to find it in and, inside each loop, there will be a call for an appropriate
content.php template. A content template basically consists of an HTML5
<article> element and there’s a content template for each available post format. That means, a basic
content.php called in various places, along with
content-single.php. Here’s a look at what the
content-aside.php will produce.
<article class="post-1062 post type-post status-publish format-aside hentry category-uncategorized" id="post-1062"> <header class="entry-header"> <h1 class="entry-title"><a rel="bookmark" title="Permalink to This is an Aside Post" href="http://example.com/2011/02/this-is-an-aside-post-2/">This is an Aside Post</a></h1> </header><!-- .entry-header --> <div class="entry-content"> </div><!-- .entry-content --> <footer class="entry-meta"> <span class="sep">Posted on </span> <a rel="bookmark" href="http://example.com/2011/02/this-is-an-aside-post-2/"><time pubdate="" datetime="2011-02-17T19:31:55+00:00" class="entry-date">February 17, 2011</time></a> <span class="sep"> by </span> <span class="author vcard"><a title="View all posts by admin" href="http://example.com/author/admin/" class="url fn n">admin</a></span> <span class="sep"> | </span> <span class="comments-link"><a title="Comment on This is an Aside Post" href="http://example.com/2011/02/this-is-an-aside-post-2/#respond">Leave a comment</a></span> <span class="edit-link"><a title="Edit Post" href="http://example.com/wp-admin/post.php?post=1062&action=edit" class="post-edit-link">Edit</a></span> </footer><!-- #entry-meta --> </article>
And, inspired by the smarter post formats technique written about by Dougal Campbell, each template is called somewhat like so:
<?php get_template_part( 'content', get_post_format() ); ?>
It might seem like more stuff but when you take a look at each template it’s really not. You get the benefit of quickly being able to call the various types of content in different locations when building portal or magazine index pages. If you wanted to pull an aside article in somewhere with a custom query, just include
get_template_part(). Or grab a page’s content, or any other post’s content. See how it makes things simpler for building themes? Want to add more templates for other Post Formats? Just add a new
content template. It’s as easy as that.
This is something I’ve experimented with in recent themes and I really like it. Look for it in the next version of Toolbox and try it out yourself in your own themes!