Dougal has a good post about using post formats (new in WordPress 3.1) in themes. His technique is pretty clean, but I much prefer letting Carrington handle the conditional code.
We landed support for post formats in Carrington Core over a month ago. To support a custom post format, all you have to do is create a new template in the /content and/or /excerpt directory:
- /content/format-image.php
- /content/format-aside.php
- /content/format-video.php
- /content/format-gallery.php
- etc.
and it will be automatically used when needed.
One of the main benefits of the Carrington Core platform is that you can build themes without having to write logic in PHP. It makes creating advanced WordPress themes more accessible to designers who are still getting their feet wet on the development side.
Curious? Check out the documentation (each Carrington theme also includes a README file in each directory that explains what file names are supported there) and feel free to contribute to it.
This post is part of the project: Carrington Core. View the project timeline for more context on this post.
[…] This post was mentioned on Twitter by blognews and Jack Dalton, web dev fools. web dev fools said: Alex King: Smarter Post Formats? Use Carrington http://bit.ly/icOKEp #wordpress […]
I had actually meant to mention Carrington in my article. But I had already spent several days editing the draft in little chunks as time became available to me, and I got too impatient to go back and edit it in. 🙂
But as I recall, you guys were using techniques similar to this long before WP 3.0 had the
get_template_part()
function.Yeah, one important concept is more granular, reusable bits. Another is the concept of a centralized place to manage priority of conditional logic (for this site, prefer tag data to author data when choosing a template, etc.). And the fact that the PHP code is abstracted away means we can have HTML/CSS folks doing some pretty fancy stuff without having to bring in devs to work on the PHP logic.