WordPress.org

Make WordPress Core

Changeset 18651


Ignore:
Timestamp:
09/07/2011 08:10:42 PM (8 years ago)
Author:
duck_
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r18445 r18651  
    330330
    331331    // Post Format
    332     $post_format = get_post_format( $post->ID );
    333 
    334332    if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
     333        $post_format = get_post_format( $post->ID );
     334
    335335        if ( $post_format && !is_wp_error($post_format) )
    336336            $classes[] = 'format-' . sanitize_html_class( $post_format );
     
    433433
    434434        // Post Format
    435         $post_format = get_post_format( $post->ID );
    436 
    437         if ( $post_format && !is_wp_error($post_format) )
    438             $classes[] = 'single-format-' . sanitize_html_class( $post_format );
    439         else
    440             $classes[] = 'single-format-standard';
     435        if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
     436            $post_format = get_post_format( $post->ID );
     437   
     438            if ( $post_format && !is_wp_error($post_format) )
     439                $classes[] = 'single-format-' . sanitize_html_class( $post_format );
     440            else
     441                $classes[] = 'single-format-standard';
     442        }
    441443
    442444        if ( is_attachment() ) {
Note: See TracChangeset for help on using the changeset viewer.