How to Activate WordPress Post Formats
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
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
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.
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
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.
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
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.
Thank you very much man. I have been searching for this for a month. thanks a lot. It’s timing one for me
You’re very welcome, Ram! We have a lot more time-saving training available to students if you’re interested. Check out: [url=http://www.ostraining.com/online]www.ostraining.com/online[/url]
I tried to add the code to my functions.php file but when I uploaded it the site broke. Does it have to be the main wordpress functions.php file or the one in the theme I am using?