Skip to content

Instantly share code, notes, and snippets.

@laras126
Created April 15, 2011 13:26
Show Gist options
  • Select an option

  • Save laras126/921676 to your computer and use it in GitHub Desktop.

Select an option

Save laras126/921676 to your computer and use it in GitHub Desktop.
post formats
<?php
// Post formats conditional in functions.php
// echo format and post classes for testing
function wpfolio_post_formats() {
global $post;
$post_id = $post->ID;
$format = get_post_format( $post_id );
if ( has_post_format( 'gallery' )) {
echo '<h3>';
echo $format . '<hr />';
echo '<strong>thematic_post_class: </strong>';
echo thematic_post_class();
echo '<hr /> <strong>post_class: </strong>';
echo post_class();
echo '</h3>';
echo the_content();
} else if ( has_post_format( 'image' )) { ...
}
add_action('thematic_post', 'wpfolio_post_formats');
?>
Sample .format-$format CSS classes:
.format-video {
background-color:blue;
}
.format-image {
background-color:blue;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment