<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[32721] trunk/src/wp-admin/includes/class-wp-posts-list-table.php: List tables: Consolidate `<td>` output for posts.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/32721">32721</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/32721","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>helen</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-06-10 14:00:55 +0000 (Wed, 10 Jun 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>List tables: Consolidate `<td>` output for posts.
see <a href="https://core.trac.wordpress.org/ticket/25408">#25408</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswppostslisttablephp">trunk/src/wp-admin/includes/class-wp-posts-list-table.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswppostslisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-posts-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-posts-list-table.php 2015-06-10 09:08:10 UTC (rev 32720)
+++ trunk/src/wp-admin/includes/class-wp-posts-list-table.php 2015-06-10 14:00:55 UTC (rev 32721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -718,6 +718,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $classes .= ' has-row-actions column-primary';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'title' === $column_name ) {
+ $classes .= ' page-title'; // Special addition for title column
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $column_name, $hidden ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -725,256 +729,236 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $attributes = "class='$classes'$style";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch ( $column_name ) {
-
- case 'cb':
- ?>
- <th scope="row" class="check-column">
- <?php
- if ( $can_edit_post ) {
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'cb' === $column_name ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <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>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <th scope="row" class="check-column">
+ <?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 } ?>
+ </th>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- ?>
- </th>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ echo "<td $attributes>";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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.
- $find_main_page = (int) $post->post_parent;
- while ( $find_main_page > 0 ) {
- $parent = get_post( $find_main_page );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch ( $column_name ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_null( $parent ) )
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'title':
+ 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.
+ $find_main_page = (int) $post->post_parent;
+ while ( $find_main_page > 0 ) {
+ $parent = get_post( $find_main_page );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $level++;
- $find_main_page = (int) $parent->post_parent;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_null( $parent ) )
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( !isset( $parent_name ) ) {
- /** This filter is documented in wp-includes/post-template.php */
- $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $level++;
+ $find_main_page = (int) $parent->post_parent;
+
+ if ( !isset( $parent_name ) ) {
+ /** This filter is documented in wp-includes/post-template.php */
+ $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $pad = str_repeat( '— ', $level );
- echo "<td $attributes><strong>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $pad = str_repeat( '— ', $level );
+ echo "<strong>";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $format = get_post_format( $post->ID ) ) {
- $label = get_post_format_string( $format );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $format = get_post_format( $post->ID ) ) {
+ $label = get_post_format_string( $format );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $can_edit_post && $post->post_status != 'trash' ) {
- echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . $pad . $title . '</a>';
- } else {
- echo $pad . $title;
- }
- _post_states( $post );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $can_edit_post && $post->post_status != 'trash' ) {
+ echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . $pad . $title . '</a>';
+ } else {
+ echo $pad . $title;
+ }
+ _post_states( $post );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $parent_name ) )
- echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $parent_name ) )
+ echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo "</strong>\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo "</strong>\n";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $can_edit_post && $post->post_status != 'trash' ) {
- if ( $lock_holder ) {
- $locked_avatar = get_avatar( $lock_holder->ID, 18 );
- $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
- } else {
- $locked_avatar = $locked_text = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $can_edit_post && $post->post_status != 'trash' ) {
+ if ( $lock_holder ) {
+ $locked_avatar = get_avatar( $lock_holder->ID, 18 );
+ $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
+ } else {
+ $locked_avatar = $locked_text = '';
+ }
+
+ echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
+ the_excerpt();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
- the_excerpt();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ get_inline_data( $post );
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $this->handle_row_actions( $post, $column_name, $primary );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'date':
+ if ( '0000-00-00 00:00:00' == $post->post_date ) {
+ $t_time = $h_time = __( 'Unpublished' );
+ $time_diff = 0;
+ } else {
+ $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
+ $m_time = $post->post_date;
+ $time = get_post_time( 'G', true, $post );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- get_inline_data( $post );
- echo '</td>';
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $time_diff = time() - $time;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'date':
- if ( '0000-00-00 00:00:00' == $post->post_date ) {
- $t_time = $h_time = __( 'Unpublished' );
- $time_diff = 0;
- } else {
- $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
- $m_time = $post->post_date;
- $time = get_post_time( 'G', true, $post );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
+ $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
+ else
+ $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $time_diff = time() - $time;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'excerpt' == $mode ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
- $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
- else
- $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filter the published time of the post.
+ *
+ * If $mode equals 'excerpt', the published time and date are both displayed.
+ * If $mode equals 'list' (default), the publish date is displayed, with the
+ * time and date together available as an abbreviation definition.
+ *
+ * @since 2.5.1
+ *
+ * @param array $t_time The published time.
+ * @param WP_Post $post Post object.
+ * @param string $column_name The column name.
+ * @param string $mode The list display mode ('excerpt' or 'list').
+ */
+ echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
+ } else {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<td ' . $attributes . '>';
- if ( 'excerpt' == $mode ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
+ echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
+ }
+ echo '<br />';
+ if ( 'publish' == $post->post_status ) {
+ _e( 'Published' );
+ } elseif ( 'future' == $post->post_status ) {
+ if ( $time_diff > 0 )
+ echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
+ else
+ _e( 'Scheduled' );
+ } else {
+ _e( 'Last Modified' );
+ }
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Filter the published time of the post.
- *
- * If $mode equals 'excerpt', the published time and date are both displayed.
- * If $mode equals 'list' (default), the publish date is displayed, with the
- * time and date together available as an abbreviation definition.
- *
- * @since 2.5.1
- *
- * @param array $t_time The published time.
- * @param WP_Post $post Post object.
- * @param string $column_name The column name.
- * @param string $mode The list display mode ('excerpt' or 'list').
- */
- echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
- } else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'comments':
+ ?>
+ <div class="post-com-count-wrapper">
+ <?php
+ $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
- echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
- }
- echo '<br />';
- if ( 'publish' == $post->post_status ) {
- _e( 'Published' );
- } elseif ( 'future' == $post->post_status ) {
- if ( $time_diff > 0 )
- echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
- else
- _e( 'Scheduled' );
- } else {
- _e( 'Last Modified' );
- }
- echo $this->handle_row_actions( $post, $column_name, $primary );
- echo '</td>';
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->comments_bubble( $post->ID, $pending_comments );
+ ?>
+ </div>
+ <?php
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'comments':
- ?>
- <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
- <?php
- $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'author':
+ 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()
+ );
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->comments_bubble( $post->ID, $pending_comments );
- ?>
- </div><?php echo $this->handle_row_actions( $post, $column_name, $primary ); ?></td>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ default:
+ if ( 'categories' == $column_name )
+ $taxonomy = 'category';
+ elseif ( 'tags' == $column_name )
+ $taxonomy = 'post_tag';
+ elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
+ $taxonomy = substr( $column_name, 9 );
+ else
+ $taxonomy = false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $taxonomy ) {
+ $taxonomy_object = get_taxonomy( $taxonomy );
+ if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
+ $out = array();
+ foreach ( $terms as $t ) {
+ $posts_in_term_qv = array();
+ if ( 'post' != $post->post_type )
+ $posts_in_term_qv['post_type'] = $post->post_type;
+ if ( $taxonomy_object->query_var ) {
+ $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
+ } else {
+ $posts_in_term_qv['taxonomy'] = $taxonomy;
+ $posts_in_term_qv['term'] = $t->slug;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- default:
- if ( 'categories' == $column_name )
- $taxonomy = 'category';
- elseif ( 'tags' == $column_name )
- $taxonomy = 'post_tag';
- elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
- $taxonomy = substr( $column_name, 9 );
- else
- $taxonomy = false;
-
- if ( $taxonomy ) {
- $taxonomy_object = get_taxonomy( $taxonomy );
- echo '<td ' . $attributes . '>';
- if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
- $out = array();
- foreach ( $terms as $t ) {
- $posts_in_term_qv = array();
- if ( 'post' != $post->post_type )
- $posts_in_term_qv['post_type'] = $post->post_type;
- if ( $taxonomy_object->query_var ) {
- $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
- } else {
- $posts_in_term_qv['taxonomy'] = $taxonomy;
- $posts_in_term_qv['term'] = $t->slug;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $out[] = sprintf( '<a href="%s">%s</a>',
+ esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
+ esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* translators: used between list items, there is a space after the comma */
+ echo join( __( ', ' ), $out );
+ } else {
+ echo '—';
+ }
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $out[] = sprintf( '<a href="%s">%s</a>',
- esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
- esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
- );
- }
- /* translators: used between list items, there is a space after the comma */
- echo join( __( ', ' ), $out );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_post_type_hierarchical( $post->post_type ) ) {
+
+ /**
+ * Fires in each custom column on the Posts list table.
+ *
+ * This hook only fires if the current post type is hierarchical,
+ * such as pages.
+ *
+ * @since 2.5.0
+ *
+ * @param string $column_name The name of the column to display.
+ * @param int $post_id The current post ID.
+ */
+ do_action( 'manage_pages_custom_column', $column_name, $post->ID );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '—';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Fires in each custom column in the Posts list table.
+ *
+ * This hook only fires if the current post type is non-hierarchical,
+ * such as posts.
+ *
+ * @since 1.5.0
+ *
+ * @param string $column_name The name of the column to display.
+ * @param int $post_id The current post ID.
+ */
+ do_action( 'manage_posts_custom_column', $column_name, $post->ID );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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 ) ) {
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Fires in each custom column on the Posts list table.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fires for each custom column of a specific post type in the Posts list table.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This hook only fires if the current post type is hierarchical,
- * such as pages.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 2.5.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 3.1.0
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $column_name The name of the column to display.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $post_id The current post ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- do_action( 'manage_pages_custom_column', $column_name, $post->ID );
- } else {
-
- /**
- * Fires in each custom column in the Posts list table.
- *
- * This hook only fires if the current post type is non-hierarchical,
- * such as posts.
- *
- * @since 1.5.0
- *
- * @param string $column_name The name of the column to display.
- * @param int $post_id The current post ID.
- */
- do_action( 'manage_posts_custom_column', $column_name, $post->ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Fires for each custom column of a specific post type in the Posts list table.
- *
- * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
- *
- * @since 3.1.0
- *
- * @param string $column_name The name of the column to display.
- * @param int $post_id The current post ID.
- */
- do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
</del><span class="cx" style="display: block; padding: 0 10px"> echo $this->handle_row_actions( $post, $column_name, $primary );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ?></td>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '</td>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span></span></pre>
</div>
</div>
</body>
</html>