From e65cce15f2ab617ff94834a75b75d9c1d40e64f1 Mon Sep 17 00:00:00 2001 From: Jon Cave 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: https://develop.svn.wordpress.org/trunk@18651 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 f5b75965db..a19691bef9 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);