Really Simple Custom Post Formats

WordPress 3.1 will come with a standardized set of post formats just like Tumblr currently supports. You can read more about it on WPDevel. But what to do if you don’t want to wait for WordPress 3.1 or you think you need to add some more specific post formats?

Well luckily giving the impression of Post Formats is really simple. All you need is the right filter. In this case display_post_states. In my example I’m using tags to check for a post format but you can use category, metakey, custom taxonomy etc.

function post_format_testing_init(){
global $custom_post_formats;
function custom_format_display_post_states($poststates){
    global $custom_post_formats;
    global $post;
        foreach($tags as $tag)
    return $poststates;

The above code yields the following result:

Go ahead and add this to your themes for a better user experience. I know at least one premium theme provider could use it.

With a little jQuery (input[@name=post_format]:change + some other stuff) and a hidden custom field you can most likely extend the upcoming default post formats with your own and have it nicely integrated with the default Post Format list. So no need for the user to add tags, categories etc to select a Post Format. But more on that in another post.

Don't be a lurker, voice your oppinion.

Leave a Reply

Keywords are not a name. If you use keywords for a name you get marked as spam, this goes for writing them in french, german etc.

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Get Adobe Flash player