Functions.php
add_theme_support('post-formats',array('aside','chat','gallery','image','link','quote','status','video','audio') );
Template file
<div id="post" >
<?php
if ( has_post_format( 'aside' )) {
echo the_content();
}
elseif ( has_post_format( 'chat' )) {
echo '<h3>';
echo the_title();
echo '</h3>';
echo the_content();
}
elseif ( has_post_format( 'gallery' )) {
echo '<h3>';
echo the_title();
echo '</h3>';
echo the_content();
}
elseif ( has_post_format( 'image' )) {
echo '<h3>';
echo the_title();
echo '</h3>';
echo the_post_thumbnail('medium');
echo the_content();
}
elseif ( has_post_format( 'link' )) {
echo '<h3>';
echo the_title();
echo '</h3>';
echo the_content();
}
elseif ( has_post_format( 'quote' )) {
echo the_content();
}
elseif ( has_post_format( 'status' )) {
echo the_content();
}
elseif ( has_post_format( 'video' )) {
echo '<h3>';
echo the_title();
echo '</h3>';
echo the_content();
}
elseif ( has_post_format( 'audio' )) {
echo '<h3>';
echo the_title();
echo '</h3>';
echo the_content();
}
else {
echo '<h3>';
echo the_title();
echo '</h3>';
echo the_content();
}
?>
</div>
<?php endwhile; else: endif; ?>
</div>
Usage:
- aside – Usually styled without a title. Similar to a Facebook note update.
- chat – A chat transcript
- gallery – A gallery of images.
- link – A link to another site. The first <a href=””> tag in the post content will be considered the external link for that post. Alternatively, if the post consists only of a URL, that will be the URL and the title (post_title) will be the name.
- image – A single image. The first <img /> tag in the post will be the image. Alternatively, if the post consists only of a URL, that will be the image URL and the title of the post (post_title) will be the title attribute for the image.
- quote – A quotation. Probably will contain a blockquote holding the quote content. Alternatively, the quote may be just the content, with the source/author being the title.
- status – A short status update, usually limited to 140 characters. Similar to a Twitter status update.
- video – A single video. The first <video /> tag or object/embed in the post content will be considered the video. Alternatively, if the post consists only of a URL, that will be the video URL.
- audio – An audio file. Could be used for Podcasting
CSS
- aside – class=”format-aside”
- image – class=”format-image”
- chat – class=”format-chat”
- gallery – class=”format-gallery”
- link – class=”format-link”
- quote – class=”format-quote”
- status – class=”format-status”
- video – class=”format-video”
- audio – class=”format-audio”
