WordPress.org

Make WordPress Core

Changeset 18706


Ignore:
Timestamp:
09/18/2011 09:11:28 PM (10 years ago)
Author:
nacin
Message:

Use get_post_class() in the posts list table. props brandondove, fixes #18516.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r18527 r18706  
    465465    function single_row( $a_post, $level = 0 ) {
    466466        global $post, $current_screen, $mode;
    467         static $rowclass;
     467        static $alternate;
    468468
    469469        $global_post = $post;
     
    471471        setup_postdata( $post );
    472472
    473         $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
    474         $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
    475473        $edit_link = get_edit_post_link( $post->ID );
    476474        $title = _draft_or_post_title();
    477475        $post_type_object = get_post_type_object( $post->post_type );
    478476        $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );
    479         $post_format = get_post_format( $post->ID );
    480         $post_format_class = ( $post_format && !is_wp_error($post_format) ) ? 'format-' . sanitize_html_class( $post_format ) : 'format-default';
     477
     478        $alternate = 'alternate' == $alternate ? '' : 'alternate';
     479        $classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
    481480    ?>
    482         <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status . ' ' . $post_format_class); ?> iedit' valign="top">
     481        <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>" valign="top">
    483482    <?php
    484483
Note: See TracChangeset for help on using the changeset viewer.