From c8a4ab1b4c11f5742010f913aaaf60b526d79b1a Mon Sep 17 00:00:00 2001 From: duck_ Date: Wed, 7 Sep 2011 20:10:42 +0000 Subject: [PATCH] Only add the post format body classes when the post type supports post formats. props ocean90. fixes #18228. git-svn-id: http://svn.automattic.com/wordpress/trunk@18651 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index f5b75965d..a19691bef 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -329,9 +329,9 @@ function get_post_class( $class = '', $post_id = null ) { $classes[] = 'status-' . $post->post_status; // Post Format - $post_format = get_post_format( $post->ID ); - 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[] = 'format-' . sanitize_html_class( $post_format ); else @@ -432,12 +432,14 @@ function get_body_class( $class = '' ) { $classes[] = 'postid-' . $post_id; // Post Format - $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 ( 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);