List tables: Consolidate <td> output for posts.

see #25408.

Built from https://develop.svn.wordpress.org/trunk@32721


git-svn-id: http://core.svn.wordpress.org/trunk@32691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2015-06-10 14:01:28 +00:00
parent ce16fd8dca
commit 3562ac028d
2 changed files with 205 additions and 221 deletions

View File

@ -718,6 +718,10 @@ class WP_Posts_List_Table extends WP_List_Table {
$classes .= ' has-row-actions column-primary';
}
if ( 'title' === $column_name ) {
$classes .= ' page-title'; // Special addition for title column
}
$style = '';
if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
@ -725,28 +729,22 @@ class WP_Posts_List_Table extends WP_List_Table {
$attributes = "class='$classes'$style";
switch ( $column_name ) {
case 'cb':
if ( 'cb' === $column_name ) {
?>
<th scope="row" class="check-column">
<?php
if ( $can_edit_post ) {
?>
<?php if ( $can_edit_post ) { ?>
<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
<div class="locked-indicator"></div>
<?php
}
?>
<?php } ?>
</th>
<?php
break;
} else {
echo "<td $attributes>";
switch ( $column_name ) {
case 'title':
$classes .= ' page-title'; // Special addition for title column
$attributes = "class='$classes'$style";
if ( $this->hierarchical_display ) {
if ( 0 == $level && (int) $post->post_parent > 0 ) {
// Sent level 0 by accident, by default, or because we don't know the actual level.
@ -769,7 +767,7 @@ class WP_Posts_List_Table extends WP_List_Table {
}
$pad = str_repeat( '&#8212; ', $level );
echo "<td $attributes><strong>";
echo "<strong>";
if ( $format = get_post_format( $post->ID ) ) {
$label = get_post_format_string( $format );
@ -803,10 +801,7 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
the_excerpt();
echo $this->handle_row_actions( $post, $column_name, $primary );
get_inline_data( $post );
echo '</td>';
break;
case 'date':
@ -826,7 +821,6 @@ class WP_Posts_List_Table extends WP_List_Table {
$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
}
echo '<td ' . $attributes . '>';
if ( 'excerpt' == $mode ) {
/**
@ -860,32 +854,25 @@ class WP_Posts_List_Table extends WP_List_Table {
} else {
_e( 'Last Modified' );
}
echo $this->handle_row_actions( $post, $column_name, $primary );
echo '</td>';
break;
case 'comments':
?>
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
<div class="post-com-count-wrapper">
<?php
$pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
$this->comments_bubble( $post->ID, $pending_comments );
?>
</div><?php echo $this->handle_row_actions( $post, $column_name, $primary ); ?></td>
</div>
<?php
break;
case 'author':
?>
<td <?php echo $attributes ?>><?php
printf( '<a href="%s">%s</a>',
esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
get_the_author()
);
echo $this->handle_row_actions( $post, $column_name, $primary );
?></td>
<?php
break;
default:
@ -900,7 +887,6 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( $taxonomy ) {
$taxonomy_object = get_taxonomy( $taxonomy );
echo '<td ' . $attributes . '>';
if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
$out = array();
foreach ( $terms as $t ) {
@ -924,12 +910,9 @@ class WP_Posts_List_Table extends WP_List_Table {
} else {
echo '&#8212;';
}
echo $this->handle_row_actions( $post, $column_name, $primary );
echo '</td>';
break;
}
?>
<td <?php echo $attributes ?>><?php
if ( is_post_type_hierarchical( $post->post_type ) ) {
/**
@ -971,11 +954,12 @@ class WP_Posts_List_Table extends WP_List_Table {
* @param int $post_id The current post ID.
*/
do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
echo $this->handle_row_actions( $post, $column_name, $primary );
?></td>
<?php
break;
}
echo $this->handle_row_actions( $post, $column_name, $primary );
echo '</td>';
}
}
?>
</tr>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32720';
$wp_version = '4.3-alpha-32721';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.