Only add the post format body classes when the post type supports post formats. props ocean90. fixes #18228.

git-svn-id: https://develop.svn.wordpress.org/trunk@18651 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jon Cave 2011-09-07 20:10:42 +00:00
parent 3dbb79d859
commit e65cce15f2
1 changed files with 10 additions and 8 deletions

View File

@ -329,9 +329,9 @@ function get_post_class( $class = '', $post_id = null ) {
$classes[] = 'status-' . $post->post_status;
// Post Format
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
$post_format = get_post_format( $post->ID );
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
if ( $post_format && !is_wp_error($post_format) )
$classes[] = 'format-' . sanitize_html_class( $post_format );
else
@ -432,12 +432,14 @@ function get_body_class( $class = '' ) {
$classes[] = 'postid-' . $post_id;
// Post Format
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
$post_format = get_post_format( $post->ID );
if ( $post_format && !is_wp_error($post_format) )
$classes[] = 'single-format-' . sanitize_html_class( $post_format );
else
$classes[] = 'single-format-standard';
}
if ( is_attachment() ) {
$mime_type = get_post_mime_type($post_id);