Post Formats and Content Templates in the Toolbox Theme

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.

Update: It’s available now! Go get it and check it out.

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-aside.php, content-gallery.php, content-page.php, and 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&amp;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 content-aside.php with 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!

23 thoughts on “Post Formats and Content Templates in the Toolbox Theme

  1. There’ll be at least one more version of Twenty Ten (the version in 3.1) released with WordPress before Twenty Eleven happens. But have no fear, Twenty Eleven will happen in 2011. :)

  2. Justin says:

    I never know when you’re talking about wordpress.com or wordpress.org stuff, especially this time because there’s a Toolbox theme for each.

    • Ian, reading my comment on a fresh day, I sense a hint of snarkiness. I legitimately didn’t know if you were still going to do wordpress.org stuff anymore. I was frustrated.

      Thanks for being so generous. I wanted a minimalist and clean wordpress theme to child theme, or at least modify slightly. Toolbox is perfect for this.

      Thematic is a little too much for the site I want to build and I tried searching elsewhere for themes. When I see basic stuff like having post titles in H2 tags in single.php, I lose any trust I have for the theme author. What else weren’t they thinking about? I’m not experienced in using PHP, so I’m not sure of that myself.

      Thanks for being so awesome that I trust your style. =)

  3. PingLu says:

    Off-Topic here, but:
    just out of curiosity, the screenshots – what editor are they from? Is it notepad++?

    • PingLu says:

      Oh, yeah. Now I see, with scroll bar and everything… sophisticated screenshots :D Nice plugin though, definitely installing it. Thanks!

  4. This may be a noob question, but I might as well. I recently started getting into the Thematic framework for making themes for my clients since it makes it quicker and easier for me to deliver them what they need. I know you guys have other themes besides Thematic like this Toolbox one. My question is, is Thematic no longer going to be supported/update with WordPress like introducing the new posts format feature? Should I move to another theme framework like this one? Thanks, for the work you guys do.

  5. I have done several projects with Thematic in the past (including my own blog) and i always loved it. I can’t wait to give Toolbox a try in a future project.

    Thanks a lot to anyone involved in making these frameworks available, they really are handy. :)

  6. Thanks for the shout-out on the content structuring. :) I’m glad to see that a few other people thought it was a good idea. The intelligent filename fallbacks in get_template_part() is what makes it so useful.

  7. Rachel says:

    Has there been any issue with people having an earlier version of Toolbox installed, then upgrading to 1.1 and losing their customizations?

    • If you’ve been making customizations in a Child Theme you should be all set but if you’ve been making direct edits you’ll want to dig into the code and check out the differences. If you’re on a Mac, FileMerge is a great tool for that.

  8. Hi

    I am the web designer at http://spirituellfilm.no/ which is Oslo Spiritual film club. The site is old and I am in the process of changing the design. My thoughts go to using wordpress because of the blogging features, contact forms and perhaps also using a database for our film archive section. The Toolbox theme looks very interesting and it seems that using the new Post Formats really makes creating different pages a breeze.

    Many of the people who check the site will likely not be using the latest browsers and probably a few of them still use IE 6. I am wondering how compatible the Toolbox theme is with older browsers? Is the Toolbox theme a good theme to use for the film club site? Or should I look at something else?

    Thanks!
    Have a great day!

    • Hi! Glad to hear you’re thinking of using WordPress. Post Formats don’t affect page layout — just Posts — but WordPress does have a template feature available that might come in handy for you, Custom Page Templates.

      Toolbox requires javascript — included with the theme and already active — to make the new semantic elements introduced in HTML5 styleable with CSS in IE8 and lower. That’s the only (very small) catch with HTML5-ified themes.

  9. Wendy says:

    Hi Ian, In the toolbox theme, the search file calls get_template_part( ‘content’, ‘search’) but I’m not finding a content-search file. I’m having a problem where, even though comments are disabled site-wide, the search results page still shows “leave a comment” link for certain pages, even though there is no commenting on that page. Trying to find out where I can turn it off. Thanks for any help. I love the toolbox theme and have used it for many sites…

  10. zignorp says:

    I think I just figured it out, I read the reference for get_template_part again, and saw that it could refer to content.php, removed the comments line from there in my child template, and it got rid of any “leave a comment” links to pages without commenting. I’m sure there’s a better solution, but that worked for me. Thanks for a great theme!

Comments are closed.