Post formats

Post formats have been introduced to WordPress in version 3.1. This is an innovative way for WordPress user to simulate Tumblr behavior and use the oldest “Post” feature in the platform to post quotes, links, images and other formats with different formatting.

In order for one to design specific image or quote behavior we used to create categories with custom templates or write custom post types with additional functionality to them. This requires additional coding for styling and separates from the most standard feature of WordPress – blog posting. That’s why post format have been added in v 3.1.

By default twenty ten (the latest one ) and twenty eleven themes have post formats enabled right below the Publish section in the Add New Post page. You could add your own post format functionality to your theme with few steps:

add_theme_support(‘post-formats’,array(

‘aside’,’gallery’,’image’,’link’,’quote’,’status’,’video’,’audio’));

This would include a list with the post formats you support in the theme. The next thing to do is a combination between post formats and styling. This could be done in different ways, easiest includes switch statement or couple of conditional statements with get_template_part() in the single.php. Each format styled its own way. Like the following:

if ( has_post_format( ‘aside’ )) {
get_template_part(‘format’, ‘aside’);
} else if ( has_post_format( ‘image’ )) {
get_template_part(‘format’, ‘image’);
} else if ( has_post_format( ‘link’ )) {
get_template_part(‘format’, ‘link’);
} else if ( has_post_format( ‘quote’ )) {
get_template_part(‘format’, ‘quote’);
} else {
get_template_part(‘format’, ‘regular’);
}


Mario Peshev is a 5x CEO and operator, founder of DevriX and Growth Shuttle, global value creation advisor, angel investor, and author of “MBA Disrupted.”

His original background in engineering rode the wave of IT entrepreneurship in the last 25 years, from product and service entrepreneurship through acquiring and selling businesses, to investing in global startups like beehiiv, doola, the Stacked Marketer, Alcatraz, SeedBlink.

Peshev spent over 10,000 hours in consulting and training contracts for mid-market and enterprise organizations like VMware, SAP, Software AG, CERN, Saudi Aramco since 2006. His books and guides are referenced in over 50 universities in North America, Europe, and Asia.


Follow Mario on social:

Latest Editions:

Latest Answers: