Make WordPress Core

Changeset 16200


Ignore:
Timestamp:
11/05/2010 06:48:56 AM (14 years ago)
Author:
markjaquith
Message:

Post Formats generate output in post_class() (format-foo), and body_class() (for single... single-format-foo). Now themers can support Post Formats with one line of PHP and by adding CSS! see #14746

File:
1 edited

Legend:

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

    r16139 r16200  
    328328    $classes[] = 'type-' . $post->post_type;
    329329    $classes[] = 'status-' . $post->post_status;
     330    if ( get_post_format( $post->ID ) )
     331        $classes[] = 'format-' . sanitize_html_class( get_post_format( $post->ID ) );
     332    else
     333        $classes[] = 'format-default';
    330334
    331335    // post requires password
     
    417421        $classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
    418422        $classes[] = 'postid-' . $post_id;
     423        if ( get_post_format( $post_id ) )
     424            $classes[] = 'single-format-' . sanitize_html_class( get_post_format( $post_id ) );
     425        else
     426            $classes[] = 'single-format-default';
    419427
    420428        if ( is_attachment() ) {
Note: See TracChangeset for help on using the changeset viewer.