How to Add Post Formats to a WordPress Theme

To add support for post formats in your WordPress theme, you first need to add the function call to your Theme Functions (functions.php) template. After you follow these few steps, there is some magic that will occur on the Add New Post page on your WordPress Dashboard. But first, follow the steps to add post formats support in your theme:

  1. From your Dashboard, choose Appearance→Editor.

  2. Click the theme functions (functions.php) file in the Templates list on the right to open it.

  3. In the text editor box, add the following function on a new line prior to the closing ?> tag:

    add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio' ) );

    The preceding code sample adds all nine of the available post formats to the theme. You don’t have to use all nine; you can simply include only those formats that you think you’ll use in your theme and leave out the rest.

  4. Click the Update File button to save the changes made to the functions.php file.

You won’t notice an immediate change to your site when you save your new theme functions file with the post formats support added. To see what WordPress has added to your site, visit the Add New Post page by choosing Posts→Add New on the Dashboard. Icons for each of the post formats appear across the top of the screen.

Because all nine post format options have been added, they’re all listed as available formats that you can select. You also see a tenth format option — Standard — which is the format used if you don’t select a specific format for your post.

image0.jpg
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com