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
This commit is contained in:
parent
6841d365e5
commit
c8a4ab1b4c
|
@ -329,9 +329,9 @@ function get_post_class( $class = '', $post_id = null ) {
|
||||||
$classes[] = 'status-' . $post->post_status;
|
$classes[] = 'status-' . $post->post_status;
|
||||||
|
|
||||||
// Post Format
|
// Post Format
|
||||||
$post_format = get_post_format( $post->ID );
|
|
||||||
|
|
||||||
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
|
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
|
||||||
|
$post_format = get_post_format( $post->ID );
|
||||||
|
|
||||||
if ( $post_format && !is_wp_error($post_format) )
|
if ( $post_format && !is_wp_error($post_format) )
|
||||||
$classes[] = 'format-' . sanitize_html_class( $post_format );
|
$classes[] = 'format-' . sanitize_html_class( $post_format );
|
||||||
else
|
else
|
||||||
|
@ -432,12 +432,14 @@ function get_body_class( $class = '' ) {
|
||||||
$classes[] = 'postid-' . $post_id;
|
$classes[] = 'postid-' . $post_id;
|
||||||
|
|
||||||
// Post Format
|
// 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[] = 'single-format-' . sanitize_html_class( $post_format );
|
if ( $post_format && !is_wp_error($post_format) )
|
||||||
else
|
$classes[] = 'single-format-' . sanitize_html_class( $post_format );
|
||||||
$classes[] = 'single-format-standard';
|
else
|
||||||
|
$classes[] = 'single-format-standard';
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_attachment() ) {
|
if ( is_attachment() ) {
|
||||||
$mime_type = get_post_mime_type($post_id);
|
$mime_type = get_post_mime_type($post_id);
|
||||||
|
|
Loading…
Reference in New Issue