Make WordPress Core


Ignore:
Timestamp:
03/21/2013 03:23:39 AM (11 years ago)
Author:
helen
Message:

Lose the added column for post formats in the posts list table and add an icon before the title instead. Icons are clickable to filter the list table down to posts of that post type and format. props melchoyce for the icons. fixes #16047.

File:
1 edited

Legend:

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

    r23742 r23765  
    259259        if ( post_type_supports( $post_type, 'author' ) )
    260260            $posts_columns['author'] = __( 'Author' );
    261 
    262         if ( post_type_supports( $post_type, 'post-formats' ) )
    263             $posts_columns['format'] = _x( 'Format', 'post format' );
    264261
    265262        $taxonomies = array();
     
    542539                $pad = str_repeat( '— ', $level );
    543540                echo "<td $attributes><strong>";
     541
     542                if ( $format = get_post_format( $post->ID ) ) {
     543                    $label = get_post_format_string( $format );
     544
     545                    echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
     546                }
     547
    544548                if ( $can_edit_post && $post->post_status != 'trash' ) {
    545549                    echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
     
    652656                    get_the_author()
    653657                );
    654             ?></td>
    655             <?php
    656             break;
    657 
    658             case 'format':
    659             ?>
    660             <td <?php echo $attributes ?>><?php
    661                 if ( get_post_format( $post->ID ) )
    662                     printf( '<a href="%s">%s</a>', add_query_arg( array( 'post_format' => get_post_format( $post->ID ), 'post_type' => $post->post_type ), 'edit.php' ), get_post_format_string( get_post_format( $post->ID ) ) );
    663                 else
    664                     echo '&#8212;';
    665658            ?></td>
    666659            <?php
Note: See TracChangeset for help on using the changeset viewer.