Add Post Formats To Any Theme

WordPress includes support for post formats built into the core.

Some themes include some post formats and others include theme specific support for posts formats.

add post formats

Regardless of what your theme supports, you can use this PHP code in your child themes functions file to over ride whatever your parent theme supports.

And here’s what the above code generates on the Post Edit screens of the Twenty Twelve default theme for WordPress.

twenty twelve post formats

The same is also true for StudioPress and other child themes running on different frameworks and parent themes.

Add Post Formats to Custom Post Types

You’ll need to add this code in your functions file to display the post formats meta box on custom post types:

add_post_type_support( 'reviews', 'post-formats' );

Swap out the name of the custom post type ‘reviews’ with the name of your own custom post type.

Add Post Formats to Pages

You’ll need to add this code in your functions file to display the post formats on Edit Page screens:

add_post_type_support( 'page', 'post-formats' );

Related Tutorials


Comments

2 responses to “Add Post Formats To Any Theme”

  1. Nathan Schmidt Avatar
    Nathan Schmidt

    Brad, if you want to take this a step further and customize the design-output of post format types, where is this done in a Genesis child theme? Would this be done in functions.php? I’ve been finding it difficult to find detailed documentation on this… most online tutorials show me how to add support for post format types, and with some I can update the little icons, such as the case w/ Genesis, but what if I want to change the entire layout of a custom post format type? Eliminate the title, post-meta, etc. in certain post format types while retaining that information for standard post format types? Just curious on what best practices are when handling this. I did find one tut on editing loop.php, but I’m not sure if this is suggested w/ Genesis as my framework, and I want to shy away from editing the parent theme if possible so updates do not wipe out my customizations.

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Nathan

      You’ll need to code a custom template.

      I would start with the landing page template as an example and use the SP code Snippets.

      You can use the WordPress Template Hierarchy for naming the file.

      There are multiple examples of custom templates with code on this site.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.