| WordPress

Something not often understood in WordPress is the difference between Post Formats and Post Types.

There are 5 page types built into WordPress: Post, Page, Attachment, Revision and Nav Menu. Since the release of 3.1 you can now add custom types, but we'll go over that in another tutorial. This tutorial is going to show you how post formats work:

There are 9 default post formats. A post format, is used to arrange content inside a post type. A post format is a specific html and css layout for showing some standardized content: aside, gallery, link, image, quote, status, video, audio, and chat.

Even though you will see these listed on your post creation page, they may not be active in your theme. To get full use of them you need to activate them by adding a line of code.

1. Edit your functions.php file

tutuploads1._Edit_your_functions_41b598055b7ef815294b4bb308c9a385.png

You'll need to download this file and open it in an editor, or you can use your control panel file manager to open and edit it.
Location of the file is /wp-includes/functions.php

BEST PRACTICE: make a copy of it and name it something like, functionsORIGINAL.php or whatever you need to so you can find it if you need to quickly recover a working copy by renaming the original back to it's original name.

2. Open the file in a text editor and scroll to the bottom

tutuploads2._Open_the_file_in_a_text_editor_and_scroll_to_the_botto_6616a9c11c3cfa470ccac1832698965e.png

You could put it at the top, or in the middle, but I find it's easier to do this at the bottom of the file. You will need to insert a line of code here. In this illustration you would insert it in line 4550. I also like to insert a comment so I know what I did and when I did it in case I come back later and have to change things.

/* Add support for custom post formats - August 2, 2011 by Ed*/
add_theme_support('post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio'));

3. Save the file and upload it to the server, overwriting the old one.

tutuploads3_c719da69480cc182e6cbc60cc8d177f6.png

When you're done, it should look similar to the picture above, with the line of code inserted before the closing bracket "}" and the php closing mark "?>"

A comment is a line in the file that won't be used by the program. Starting the line with /* and ending it with */ will "comment out" the line. (In yellow in the illustration.)

Before you upload it, did you make a backup copy of the original? If you get any error messages, restore the original so your site won't be down while you figure it out.

Example: Sample Post with Standard Format applied

tutuploadsExample_Sample_post_with_Standard_Format_applied_1bdf4d320e554672cf2d14e49da54b19.png

In the standard format, you can see the Headline, and the Posted on date and the balloon in the upper right. This is what a post looks like in Theme 2011. After adding the line of code to functions.php, you get additional choices.

Example: Here's the story with the "Status" format applied.

tutuploadsExample_Here_s_the_story_with_the_Status_format_applied._bc4e1c0e216a59760666cf4c8810295e.png

After checking the "Status" check box on the editing page the post now displays without the headline and date, and adds the member's avatar.

Example: Aside format

tutuploadsExample_Aside_format_fc4b6da0bd6f50596889afd7266859e6.png

WordPress supports the following post formats. These formats cannot be changed by the average user and are meant to be standards of typical formats.

  • aside - A short piece of content, typically styled without a title.
  • gallery - A gallery of images.
  • link - A single link to another site.
  • image - A single image.
  • status - A short status update, similar to a Twitter status update.
  • video - A single video.
  • audio - A single audio file.
  • chat - A chat transcript.