WordPress.org

Make WordPress Core

Ticket #14746: ticket.14746.post_class.diff

File ticket.14746.post_class.diff, 623 bytes (added by ptahdunbar, 8 years ago)

Adds post formats support in post_class()

  • wp-includes/post-template.php

     
    357357                $classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id);
    358358        }
    359359
     360        // Post Formats
     361        $post_format = get_post_format( $post );
     362        if ( $post_format && !is_wp_error($post_format) )
     363                $classes[] = 'post-format-' . esc_attr( $post_format );
     364        else
     365                $classes[] = 'post-format-default';
     366
    360367        if ( !empty($class) ) {
    361368                if ( !is_array( $class ) )
    362369                        $class = preg_split('#\s+#', $class);