WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Mar 03 2011

Post Formats in WordPress 3.1: Checking for Theme Support and Adding Theme Support

With WordPress 3.1, Post Formats were added, which makes WordPress a hybrid between its traditional CMS/blog environment and Tumblr's quick posting format. This cross or hybrid makes WordPress much more powerful and flexible.

To check to see whether the current theme supports post formats use the following conditional to do nothing if the theme does not support post formats:
[php]if ( !current_theme_supports( 'post-formats' ) || !function_exists( 'get_post_format' ) )
return;[/php]

Or with Genesis:
[php]if ( !current_theme_supports( 'post-formats' ) || !current_theme_supports( 'genesis-post-format-images' ) || !function_exists( 'get_post_format' ) )
return;[/php]

To add theme support for post formats, you will need to add the following:
[php]add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );[/php]

For Genesis child themes, you'll need to add an additional theme support which is used in the genesis function, genesis_do_post_format_image().
[php]add_theme_support( 'genesis-post-format-images' );[/php]

Written by Travis Smith · Categorized: Genesis

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in