<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[15500] trunk/wp-admin/includes/default-list-tables.php: In WP_Posts_Table,
  merge _single_row_hierarchical() and _single_row().</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15500">15500</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-08-15 22:36:17 +0000 (Sun, 15 Aug 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>In WP_Posts_Table, merge _single_row_hierarchical() and _single_row(). Fixes <a href="http://trac.wordpress.org/ticket/14089">#14089</a>; see <a href="http://trac.wordpress.org/ticket/14579">#14579</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesdefaultlisttablesphp">trunk/wp-admin/includes/default-list-tables.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesdefaultlisttablesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/default-list-tables.php (15499 => 15500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/default-list-tables.php        2010-08-15 19:12:06 UTC (rev 15499)
+++ trunk/wp-admin/includes/default-list-tables.php        2010-08-15 22:36:17 UTC (rev 15500)
</span><span class="lines">@@ -12,16 +12,25 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> class WP_Posts_Table extends WP_List_Table {
</span><del>-        
</del><ins>+
</ins><span class="cx">         /**
</span><span class="cx">          * Wether the items should be displayed hierarchically or linearly
</span><span class="cx">          *
</span><span class="cx">          * @since 3.1.0
</span><span class="cx">          * @var bool
</span><del>-         * @access private
</del><ins>+         * @access protected
</ins><span class="cx">          */
</span><del>-        var $_hierarchical_display;
</del><ins>+        var $hierarchical_display;
</ins><span class="cx"> 
</span><ins>+        /**
+         * Holds the number of pending comments for each post
+         *
+         * @since 3.1.0
+         * @var bool
+         * @access protected
+         */
+        var $comment_pending_count;
+
</ins><span class="cx">         function WP_Posts_Table() {
</span><span class="cx">                 global $post_type_object, $post_type, $current_screen;
</span><span class="cx"> 
</span><span class="lines">@@ -53,9 +62,9 @@
</span><span class="cx"> 
</span><span class="cx">                 $avail_post_stati = wp_edit_posts_query();
</span><span class="cx"> 
</span><del>-                $this-&gt;_hierarchical_display = ( $post_type_object-&gt;hierarchical &amp;&amp; 0 === strpos( get_query_var( 'orderby' ), 'menu_order' ) );
</del><ins>+                $this-&gt;hierarchical_display = ( $post_type_object-&gt;hierarchical &amp;&amp; 0 === strpos( get_query_var( 'orderby' ), 'menu_order' ) );
</ins><span class="cx"> 
</span><del>-                $total_items = $this-&gt;_hierarchical_display ? $wp_query-&gt;post_count : $wp_query-&gt;found_posts;
</del><ins>+                $total_items = $this-&gt;hierarchical_display ? $wp_query-&gt;post_count : $wp_query-&gt;found_posts;
</ins><span class="cx"> 
</span><span class="cx">                 $edit_per_page = 'edit_' . $post_type . '_per_page'; 
</span><span class="cx">                  $per_page = (int) get_user_option( $edit_per_page );
</span><span class="lines">@@ -64,7 +73,7 @@
</span><span class="cx">                 $per_page = apply_filters( $edit_per_page, $per_page ); 
</span><span class="cx">                  $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 
</span><span class="cx"> 
</span><del>-                if ( $this-&gt;_hierarchical_display )
</del><ins>+                if ( $this-&gt;hierarchical_display )
</ins><span class="cx">                         $total_pages = ceil( $total_items / $per_page );
</span><span class="cx">                 else
</span><span class="cx">                         $total_pages = $wp_query-&gt;max_num_pages;
</span><span class="lines">@@ -205,7 +214,7 @@
</span><span class="cx">                 if ( empty( $posts ) )
</span><span class="cx">                         $posts = $wp_query-&gt;posts;
</span><span class="cx"> 
</span><del>-                if ( $this-&gt;_hierarchical_display ) {
</del><ins>+                if ( $this-&gt;hierarchical_display ) {
</ins><span class="cx">                         $this-&gt;_display_rows_hierarchical( $posts, $this-&gt;get_pagenum(), $per_page );
</span><span class="cx">                 } else {
</span><span class="cx">                         $this-&gt;_display_rows( $posts );
</span><span class="lines">@@ -223,14 +232,10 @@
</span><span class="cx">                 foreach ( $posts as $a_post )
</span><span class="cx">                         $post_ids[] = $a_post-&gt;ID;
</span><span class="cx"> 
</span><del>-                $comment_pending_count = get_pending_comments_num( $post_ids );
</del><ins>+                $this-&gt;comment_pending_count = get_pending_comments_num( $post_ids );
</ins><span class="cx"> 
</span><del>-                foreach ( $posts as $post ) {
-                        if ( empty( $comment_pending_count[$post-&gt;ID] ) )
-                                $comment_pending_count[$post-&gt;ID] = 0;
-
-                        $this-&gt;_single_row( $post, $comment_pending_count[$post-&gt;ID], $mode );
-                }
</del><ins>+                foreach ( $posts as $post )
+                        $this-&gt;single_row( $post );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
</span><span class="lines">@@ -284,7 +289,7 @@
</span><span class="cx">                                 break;
</span><span class="cx"> 
</span><span class="cx">                         if ( $count &gt;= $start )
</span><del>-                                echo &quot;\t&quot; . $this-&gt;_single_row_hierarchical( $page, $level );
</del><ins>+                                echo &quot;\t&quot; . $this-&gt;single_row( $page, $level );
</ins><span class="cx"> 
</span><span class="cx">                         $count++;
</span><span class="cx"> 
</span><span class="lines">@@ -299,7 +304,7 @@
</span><span class="cx">                                         if ( $count &gt;= $end )
</span><span class="cx">                                                 break;
</span><span class="cx">                                         if ( $count &gt;= $start )
</span><del>-                                                echo &quot;\t&quot; . $this-&gt;_single_row_hierarchical( $op, 0 );
</del><ins>+                                                echo &quot;\t&quot; . $this-&gt;single_row( $op, 0 );
</ins><span class="cx">                                         $count++;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="lines">@@ -345,13 +350,13 @@
</span><span class="cx">                                 }
</span><span class="cx">                                 $num_parents = count( $my_parents );
</span><span class="cx">                                 while ( $my_parent = array_pop( $my_parents ) ) {
</span><del>-                                        echo &quot;\t&quot; . $this-&gt;_single_row_hierarchical( $my_parent, $level - $num_parents );
</del><ins>+                                        echo &quot;\t&quot; . $this-&gt;single_row( $my_parent, $level - $num_parents );
</ins><span class="cx">                                         $num_parents--;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         if ( $count &gt;= $start )
</span><del>-                                echo &quot;\t&quot; . $this-&gt;_single_row_hierarchical( $page, $level );
</del><ins>+                                echo &quot;\t&quot; . $this-&gt;single_row( $page, $level );
</ins><span class="cx"> 
</span><span class="cx">                         $count++;
</span><span class="cx"> 
</span><span class="lines">@@ -361,187 +366,10 @@
</span><span class="cx">                 unset( $children_pages[$parent] ); //required in order to keep track of orphans
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        /**
-         * display one row if the page doesn't have any children
-         * otherwise, display the row and its children in subsequent rows
-         *
-         * @since unknown
-         *
-         * @param unknown_type $page
-         * @param unknown_type $level
-         */
-        function _single_row_hierarchical( $page, $level = 0 ) {
-                global $post, $current_screen;
</del><ins>+        function single_row( $a_post, $level = 0 ) {
+                global $post, $current_screen, $mode;
</ins><span class="cx">                 static $rowclass;
</span><span class="cx"> 
</span><del>-                $post = $page;
-                setup_postdata( $page );
-
-                if ( 0 == $level &amp;&amp; (int) $page-&gt;post_parent &gt; 0 ) {
-                        //sent level 0 by accident, by default, or because we don't know the actual level
-                        $find_main_page = (int) $page-&gt;post_parent;
-                        while ( $find_main_page &gt; 0 ) {
-                                $parent = get_page( $find_main_page );
-
-                                if ( is_null( $parent ) )
-                                        break;
-
-                                $level++;
-                                $find_main_page = (int) $parent-&gt;post_parent;
-
-                                if ( !isset( $parent_name ) )
-                                        $parent_name = $parent-&gt;post_title;
-                        }
-                }
-
-                $page-&gt;post_title = esc_html( $page-&gt;post_title );
-                $pad = str_repeat( '&amp;#8212; ', $level );
-                $id = (int) $page-&gt;ID;
-                $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
-                $title = _draft_or_post_title();
-                $post_type = $page-&gt;post_type;
-                $post_type_object = get_post_type_object( $post_type );
-?&gt;
-        &lt;tr id=&quot;post-&lt;?php echo $id; ?&gt;&quot; class=&quot;&lt;?php echo $rowclass; ?&gt; iedit&quot;&gt;
-&lt;?php
-
-        list( $columns, $hidden ) = $this-&gt;get_column_headers();
-
-        foreach ( $columns as $column_name =&gt; $column_display_name ) {
-                $class = &quot;class=\&quot;$column_name column-$column_name\&quot;&quot;;
-
-                $style = '';
-                if ( in_array( $column_name, $hidden ) )
-                        $style = ' style=&quot;display:none;&quot;';
-
-                $attributes = &quot;$class$style&quot;;
-
-                switch ( $column_name ) {
-
-                case 'cb':
-                        ?&gt;
-                        &lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt;&lt;?php if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $page-&gt;ID ) ) { ?&gt;&lt;input type=&quot;checkbox&quot; name=&quot;post[]&quot; value=&quot;&lt;?php the_ID(); ?&gt;&quot; /&gt;&lt;?php } ?&gt;&lt;/th&gt;
-                        &lt;?php
-                        break;
-                case 'date':
-                        if ( '0000-00-00 00:00:00' == $page-&gt;post_date &amp;&amp; 'date' == $column_name ) {
-                                $t_time = $h_time = __( 'Unpublished' );
-                                $time_diff = 0;
-                        } else {
-                                $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
-                                $m_time = $page-&gt;post_date;
-                                $time = get_post_time( 'G', true );
-
-                                $time_diff = time() - $time;
-
-                                if ( $time_diff &gt; 0 &amp;&amp; $time_diff &lt; 24*60*60 )
-                                        $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
-                                else
-                                        $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
-                        }
-                        echo '&lt;td ' . $attributes . '&gt;';
-                        echo '&lt;abbr title=&quot;' . $t_time . '&quot;&gt;' . apply_filters( 'post_date_column_time', $h_time, $page, $column_name, '' ) . '&lt;/abbr&gt;';
-                        echo '&lt;br /&gt;';
-                        if ( 'publish' == $page-&gt;post_status ) {
-                                _e( 'Published' );
-                        } elseif ( 'future' == $page-&gt;post_status ) {
-                                if ( $time_diff &gt; 0 )
-                                        echo '&lt;strong class=&quot;attention&quot;&gt;' . __( 'Missed schedule' ) . '&lt;/strong&gt;';
-                                else
-                                        _e( 'Scheduled' );
-                        } else {
-                                _e( 'Last Modified' );
-                        }
-                        echo '&lt;/td&gt;';
-                        break;
-                case 'title':
-                        $attributes = 'class=&quot;post-title page-title column-title&quot;' . $style;
-                        $edit_link = get_edit_post_link( $page-&gt;ID );
-                        ?&gt;
-                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;strong&gt;&lt;?php if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $page-&gt;ID ) &amp;&amp; $post-&gt;post_status != 'trash' ) { ?&gt;&lt;a class=&quot;row-title&quot; href=&quot;&lt;?php echo $edit_link; ?&gt;&quot; title=&quot;&lt;?php echo esc_attr( sprintf( __( 'Edit &amp;#8220;%s&amp;#8221;' ), $title ) ); ?&gt;&quot;&gt;&lt;?php echo $pad; echo $title ?&gt;&lt;/a&gt;&lt;?php } else { echo $pad; echo $title; }; _post_states( $page ); echo isset( $parent_name ) ? ' | ' . $post_type_object-&gt;labels-&gt;parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?&gt;&lt;/strong&gt;
-                        &lt;?php
-                        $actions = array();
-                        if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $page-&gt;ID ) &amp;&amp; $post-&gt;post_status != 'trash' ) {
-                                $actions['edit'] = '&lt;a href=&quot;' . $edit_link . '&quot; title=&quot;' . esc_attr( __( 'Edit this page' ) ) . '&quot;&gt;' . __( 'Edit' ) . '&lt;/a&gt;';
-                                $actions['inline'] = '&lt;a href=&quot;#&quot; class=&quot;editinline&quot;&gt;' . __( 'Quick&amp;nbsp;Edit' ) . '&lt;/a&gt;';
-                        }
-                        if ( current_user_can( $post_type_object-&gt;cap-&gt;delete_post, $page-&gt;ID ) ) {
-                                if ( $post-&gt;post_status == 'trash' )
-                                        $actions['untrash'] = &quot;&lt;a title='&quot; . esc_attr( __( 'Remove this page from the Trash' ) ) . &quot;' href='&quot; . wp_nonce_url( &quot;post.php?post_type=$post_type&amp;amp;action=untrash&amp;amp;post=$page-&gt;ID&quot;, 'untrash-' . $post-&gt;post_type . '_' . $page-&gt;ID ) . &quot;'&gt;&quot; . __( 'Restore' ) . &quot;&lt;/a&gt;&quot;;
-                                elseif ( EMPTY_TRASH_DAYS )
-                                        $actions['trash'] = &quot;&lt;a class='submitdelete' title='&quot; . esc_attr( __( 'Move this page to the Trash' ) ) . &quot;' href='&quot; . get_delete_post_link( $page-&gt;ID ) . &quot;'&gt;&quot; . __( 'Trash' ) . &quot;&lt;/a&gt;&quot;;
-                                if ( $post-&gt;post_status == 'trash' || !EMPTY_TRASH_DAYS )
-                                        $actions['delete'] = &quot;&lt;a class='submitdelete' title='&quot; . esc_attr( __( 'Delete this page permanently' ) ) . &quot;' href='&quot; . wp_nonce_url( &quot;post.php?post_type=$post_type&amp;amp;action=delete&amp;amp;post=$page-&gt;ID&quot;, 'delete-' . $post-&gt;post_type . '_' . $page-&gt;ID ) . &quot;'&gt;&quot; . __( 'Delete Permanently' ) . &quot;&lt;/a&gt;&quot;;
-                        }
-                        if ( in_array( $post-&gt;post_status, array( 'pending', 'draft' ) ) ) {
-                                if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $page-&gt;ID ) )
-                                        $actions['view'] = '&lt;a href=&quot;' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $page-&gt;ID ) ) ) . '&quot; title=&quot;' . esc_attr( sprintf( __( 'Preview &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot; rel=&quot;permalink&quot;&gt;' . __( 'Preview' ) . '&lt;/a&gt;';
-                        } elseif ( $post-&gt;post_status != 'trash' ) {
-                                $actions['view'] = '&lt;a href=&quot;' . get_permalink( $page-&gt;ID ) . '&quot; title=&quot;' . esc_attr( sprintf( __( 'View &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot; rel=&quot;permalink&quot;&gt;' . __( 'View' ) . '&lt;/a&gt;';
-                        }
-                        $actions = apply_filters( 'page_row_actions', $actions, $page );
-                        $action_count = count( $actions );
-
-                        $i = 0;
-                        echo '&lt;div class=&quot;row-actions&quot;&gt;';
-                        foreach ( $actions as $action =&gt; $link ) {
-                                ++$i;
-                                ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
-                                echo &quot;&lt;span class='$action'&gt;$link$sep&lt;/span&gt;&quot;;
-                        }
-                        echo '&lt;/div&gt;';
-
-                        get_inline_data( $post );
-                        echo '&lt;/td&gt;';
-                        break;
-
-                case 'comments':
-                        ?&gt;
-                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;div class=&quot;post-com-count-wrapper&quot;&gt;
-                        &lt;?php
-                        $left = get_pending_comments_num( $page-&gt;ID );
-                        $pending_phrase = sprintf( __( '%s pending' ), number_format( $left ) );
-                        if ( $left )
-                                echo '&lt;strong&gt;';
-                        comments_number(
-                                &quot;&lt;a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'&gt;&lt;span class='comment-count'&gt;&quot;
-                                . /* translators: comment count link */ _x( '0', 'comment count' ) . '&lt;/span&gt;&lt;/a&gt;',
-                                &quot;&lt;a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'&gt;&lt;span class='comment-count'&gt;&quot;
-                                . /* translators: comment count link */ _x( '1', 'comment count' ) . '&lt;/span&gt;&lt;/a&gt;',
-                                &quot;&lt;a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'&gt;&lt;span class='comment-count'&gt;&quot;
-                                . /* translators: comment count link: % will be substituted by comment count */ _x( '%', 'comment count' ) . '&lt;/span&gt;&lt;/a&gt;'
-                        );
-                        if ( $left )
-                                echo '&lt;/strong&gt;';
-                        ?&gt;
-                        &lt;/div&gt;&lt;/td&gt;
-                        &lt;?php
-                        break;
-
-                case 'author':
-                        ?&gt;
-                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;a href=&quot;edit.php?post_type=&lt;?php echo $post_type; ?&gt;&amp;amp;author=&lt;?php the_author_meta( 'ID' ); ?&gt;&quot;&gt;&lt;?php the_author() ?&gt;&lt;/a&gt;&lt;/td&gt;
-                        &lt;?php
-                        break;
-
-                default:
-                        ?&gt;
-                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;?php do_action( 'manage_pages_custom_column', $column_name, $id ); ?&gt;&lt;/td&gt;
-                        &lt;?php
-                        break;
-                }
-        }
-?&gt;
-
-        &lt;/tr&gt;
-
-&lt;?php
-        }
-
-        function _single_row( $a_post, $pending_comments, $mode ) {
-                global $post, $current_screen;
-                static $rowclass;
-
</del><span class="cx">                 $global_post = $post;
</span><span class="cx">                 $post = $a_post;
</span><span class="cx">                 setup_postdata( $post );
</span><span class="lines">@@ -551,6 +379,7 @@
</span><span class="cx">                 $edit_link = get_edit_post_link( $post-&gt;ID );
</span><span class="cx">                 $title = _draft_or_post_title();
</span><span class="cx">                 $post_type_object = get_post_type_object( $post-&gt;post_type );
</span><ins>+                $can_edit_post = current_user_can( 'edit_post', $post-&gt;ID );
</ins><span class="cx">         ?&gt;
</span><span class="cx">                 &lt;tr id='post-&lt;?php echo $post-&gt;ID; ?&gt;' class='&lt;?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post-&gt;post_status ); ?&gt; iedit' valign=&quot;top&quot;&gt;
</span><span class="cx">         &lt;?php
</span><span class="lines">@@ -570,10 +399,81 @@
</span><span class="cx"> 
</span><span class="cx">                         case 'cb':
</span><span class="cx">                         ?&gt;
</span><del>-                        &lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt;&lt;?php if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $post-&gt;ID ) ) { ?&gt;&lt;input type=&quot;checkbox&quot; name=&quot;post[]&quot; value=&quot;&lt;?php the_ID(); ?&gt;&quot; /&gt;&lt;?php } ?&gt;&lt;/th&gt;
</del><ins>+                        &lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt;&lt;?php if ( $can_edit_post ) { ?&gt;&lt;input type=&quot;checkbox&quot; name=&quot;post[]&quot; value=&quot;&lt;?php the_ID(); ?&gt;&quot; /&gt;&lt;?php } ?&gt;&lt;/th&gt;
</ins><span class="cx">                         &lt;?php
</span><span class="cx">                         break;
</span><span class="cx"> 
</span><ins>+                        case 'title':
+                                if ( $this-&gt;hierarchical_display ) {
+                                        $attributes = 'class=&quot;post-title page-title column-title&quot;' . $style;
+
+                                        if ( 0 == $level &amp;&amp; (int) $post-&gt;post_parent &gt; 0 ) {
+                                                //sent level 0 by accident, by default, or because we don't know the actual level
+                                                $find_main_page = (int) $post-&gt;post_parent;
+                                                while ( $find_main_page &gt; 0 ) {
+                                                        $parent = get_page( $find_main_page );
+
+                                                        if ( is_null( $parent ) )
+                                                                break;
+
+                                                        $level++;
+                                                        $find_main_page = (int) $parent-&gt;post_parent;
+
+                                                        if ( !isset( $parent_name ) )
+                                                                $parent_name = $parent-&gt;post_title;
+                                                }
+                                        }
+
+                                        $post-&gt;post_title = esc_html( $post-&gt;post_title );
+                                        $pad = str_repeat( '&amp;#8212; ', $level );
+?&gt;
+                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;strong&gt;&lt;?php if ( $can_edit_post &amp;&amp; $post-&gt;post_status != 'trash' ) { ?&gt;&lt;a class=&quot;row-title&quot; href=&quot;&lt;?php echo $edit_link; ?&gt;&quot; title=&quot;&lt;?php echo esc_attr( sprintf( __( 'Edit &amp;#8220;%s&amp;#8221;' ), $title ) ); ?&gt;&quot;&gt;&lt;?php echo $pad; echo $title ?&gt;&lt;/a&gt;&lt;?php } else { echo $pad; echo $title; }; _post_states( $post ); echo isset( $parent_name ) ? ' | ' . $post_type_object-&gt;labels-&gt;parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?&gt;&lt;/strong&gt;
+&lt;?php
+                                }
+                                else {
+                                        $attributes = 'class=&quot;post-title page-title column-title&quot;' . $style;
+?&gt;
+                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;strong&gt;&lt;?php if ( $can_edit_post &amp;&amp; $post-&gt;post_status != 'trash' ) { ?&gt;&lt;a class=&quot;row-title&quot; href=&quot;&lt;?php echo $edit_link; ?&gt;&quot; title=&quot;&lt;?php echo esc_attr( sprintf( __( 'Edit &amp;#8220;%s&amp;#8221;' ), $title ) ); ?&gt;&quot;&gt;&lt;?php echo $title ?&gt;&lt;/a&gt;&lt;?php } else { echo $title; }; _post_states( $post ); ?&gt;&lt;/strong&gt;
+&lt;?php
+                                        if ( 'excerpt' == $mode ) {
+                                                the_excerpt();
+                                        }
+                                }
+
+                                $actions = array();
+                                if ( $can_edit_post &amp;&amp; 'trash' != $post-&gt;post_status ) {
+                                        $actions['edit'] = '&lt;a href=&quot;' . get_edit_post_link( $post-&gt;ID, true ) . '&quot; title=&quot;' . esc_attr( __( 'Edit this item' ) ) . '&quot;&gt;' . __( 'Edit' ) . '&lt;/a&gt;';
+                                        $actions['inline hide-if-no-js'] = '&lt;a href=&quot;#&quot; class=&quot;editinline&quot; title=&quot;' . esc_attr( __( 'Edit this item inline' ) ) . '&quot;&gt;' . __( 'Quick&amp;nbsp;Edit' ) . '&lt;/a&gt;';
+                                }
+                                if ( current_user_can( $post_type_object-&gt;cap-&gt;delete_post, $post-&gt;ID ) ) {
+                                        if ( 'trash' == $post-&gt;post_status )
+                                                $actions['untrash'] = &quot;&lt;a title='&quot; . esc_attr( __( 'Restore this item from the Trash' ) ) . &quot;' href='&quot; . wp_nonce_url( admin_url( sprintf( $post_type_object-&gt;_edit_link . '&amp;amp;action=untrash', $post-&gt;ID ) ), 'untrash-' . $post-&gt;post_type . '_' . $post-&gt;ID ) . &quot;'&gt;&quot; . __( 'Restore' ) . &quot;&lt;/a&gt;&quot;;
+                                        elseif ( EMPTY_TRASH_DAYS )
+                                                $actions['trash'] = &quot;&lt;a class='submitdelete' title='&quot; . esc_attr( __( 'Move this item to the Trash' ) ) . &quot;' href='&quot; . get_delete_post_link( $post-&gt;ID ) . &quot;'&gt;&quot; . __( 'Trash' ) . &quot;&lt;/a&gt;&quot;;
+                                        if ( 'trash' == $post-&gt;post_status || !EMPTY_TRASH_DAYS )
+                                                $actions['delete'] = &quot;&lt;a class='submitdelete' title='&quot; . esc_attr( __( 'Delete this item permanently' ) ) . &quot;' href='&quot; . get_delete_post_link( $post-&gt;ID, '', true ) . &quot;'&gt;&quot; . __( 'Delete Permanently' ) . &quot;&lt;/a&gt;&quot;;
+                                }
+                                if ( in_array( $post-&gt;post_status, array( 'pending', 'draft' ) ) ) {
+                                        if ( $can_edit_post )
+                                                $actions['view'] = '&lt;a href=&quot;' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post-&gt;ID ) ) ) . '&quot; title=&quot;' . esc_attr( sprintf( __( 'Preview &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot; rel=&quot;permalink&quot;&gt;' . __( 'Preview' ) . '&lt;/a&gt;';
+                                } elseif ( 'trash' != $post-&gt;post_status ) {
+                                        $actions['view'] = '&lt;a href=&quot;' . get_permalink( $post-&gt;ID ) . '&quot; title=&quot;' . esc_attr( sprintf( __( 'View &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot; rel=&quot;permalink&quot;&gt;' . __( 'View' ) . '&lt;/a&gt;';
+                                }
+
+                                $actions = apply_filters( $this-&gt;hierarchical_display ? 'page_row_actions' : 'post_row_actions', $actions, $post );
+                                $action_count = count( $actions );
+                                $i = 0;
+                                echo '&lt;div class=&quot;row-actions&quot;&gt;';
+                                foreach ( $actions as $action =&gt; $link ) {
+                                        ++$i;
+                                        ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                                        echo &quot;&lt;span class='$action'&gt;$link$sep&lt;/span&gt;&quot;;
+                                }
+                                echo '&lt;/div&gt;';
+
+                                get_inline_data( $post );
+                        break;
+
</ins><span class="cx">                         case 'date':
</span><span class="cx">                                 if ( '0000-00-00 00:00:00' == $post-&gt;post_date &amp;&amp; 'date' == $column_name ) {
</span><span class="cx">                                         $t_time = $h_time = __( 'Unpublished' );
</span><span class="lines">@@ -610,59 +510,19 @@
</span><span class="cx">                                 echo '&lt;/td&gt;';
</span><span class="cx">                         break;
</span><span class="cx"> 
</span><del>-                        case 'title':
-                                $attributes = 'class=&quot;post-title column-title&quot;' . $style;
-                        ?&gt;
-                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;strong&gt;&lt;?php if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $post-&gt;ID ) &amp;&amp; $post-&gt;post_status != 'trash' ) { ?&gt;&lt;a class=&quot;row-title&quot; href=&quot;&lt;?php echo $edit_link; ?&gt;&quot; title=&quot;&lt;?php echo esc_attr( sprintf( __( 'Edit &amp;#8220;%s&amp;#8221;' ), $title ) ); ?&gt;&quot;&gt;&lt;?php echo $title ?&gt;&lt;/a&gt;&lt;?php } else { echo $title; }; _post_states( $post ); ?&gt;&lt;/strong&gt;
-                        &lt;?php
-                                if ( 'excerpt' == $mode )
-                                        the_excerpt();
-
-                                $actions = array();
-                                if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $post-&gt;ID ) &amp;&amp; 'trash' != $post-&gt;post_status ) {
-                                        $actions['edit'] = '&lt;a href=&quot;' . get_edit_post_link( $post-&gt;ID, true ) . '&quot; title=&quot;' . esc_attr( __( 'Edit this item' ) ) . '&quot;&gt;' . __( 'Edit' ) . '&lt;/a&gt;';
-                                        $actions['inline hide-if-no-js'] = '&lt;a href=&quot;#&quot; class=&quot;editinline&quot; title=&quot;' . esc_attr( __( 'Edit this item inline' ) ) . '&quot;&gt;' . __( 'Quick&amp;nbsp;Edit' ) . '&lt;/a&gt;';
-                                }
-                                if ( current_user_can( $post_type_object-&gt;cap-&gt;delete_post, $post-&gt;ID ) ) {
-                                        if ( 'trash' == $post-&gt;post_status )
-                                                $actions['untrash'] = &quot;&lt;a title='&quot; . esc_attr( __( 'Restore this item from the Trash' ) ) . &quot;' href='&quot; . wp_nonce_url( admin_url( sprintf( $post_type_object-&gt;_edit_link . '&amp;amp;action=untrash', $post-&gt;ID ) ), 'untrash-' . $post-&gt;post_type . '_' . $post-&gt;ID ) . &quot;'&gt;&quot; . __( 'Restore' ) . &quot;&lt;/a&gt;&quot;;
-                                        elseif ( EMPTY_TRASH_DAYS )
-                                                $actions['trash'] = &quot;&lt;a class='submitdelete' title='&quot; . esc_attr( __( 'Move this item to the Trash' ) ) . &quot;' href='&quot; . get_delete_post_link( $post-&gt;ID ) . &quot;'&gt;&quot; . __( 'Trash' ) . &quot;&lt;/a&gt;&quot;;
-                                        if ( 'trash' == $post-&gt;post_status || !EMPTY_TRASH_DAYS )
-                                                $actions['delete'] = &quot;&lt;a class='submitdelete' title='&quot; . esc_attr( __( 'Delete this item permanently' ) ) . &quot;' href='&quot; . get_delete_post_link( $post-&gt;ID, '', true ) . &quot;'&gt;&quot; . __( 'Delete Permanently' ) . &quot;&lt;/a&gt;&quot;;
-                                }
-                                if ( in_array( $post-&gt;post_status, array( 'pending', 'draft' ) ) ) {
-                                        if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $post-&gt;ID ) )
-                                                $actions['view'] = '&lt;a href=&quot;' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post-&gt;ID ) ) ) . '&quot; title=&quot;' . esc_attr( sprintf( __( 'Preview &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot; rel=&quot;permalink&quot;&gt;' . __( 'Preview' ) . '&lt;/a&gt;';
-                                } elseif ( 'trash' != $post-&gt;post_status ) {
-                                        $actions['view'] = '&lt;a href=&quot;' . get_permalink( $post-&gt;ID ) . '&quot; title=&quot;' . esc_attr( sprintf( __( 'View &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot; rel=&quot;permalink&quot;&gt;' . __( 'View' ) . '&lt;/a&gt;';
-                                }
-                                $actions = apply_filters( 'post_row_actions', $actions, $post );
-                                $action_count = count( $actions );
-                                $i = 0;
-                                echo '&lt;div class=&quot;row-actions&quot;&gt;';
-                                foreach ( $actions as $action =&gt; $link ) {
-                                        ++$i;
-                                        ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
-                                        echo &quot;&lt;span class='$action'&gt;$link$sep&lt;/span&gt;&quot;;
-                                }
-                                echo '&lt;/div&gt;';
-
-                                get_inline_data( $post );
-                        ?&gt;
-                        &lt;/td&gt;
-                        &lt;?php
-                        break;
-
</del><span class="cx">                         case 'categories':
</span><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;?php
</span><span class="cx">                                 $categories = get_the_category();
</span><span class="cx">                                 if ( !empty( $categories ) ) {
</span><span class="cx">                                         $out = array();
</span><del>-                                        foreach ( $categories as $c )
-                                                $out[] = &quot;&lt;a href='edit.php?post_type={$post-&gt;post_type}&amp;amp;category_name={$c-&gt;slug}'&gt; &quot; . esc_html( sanitize_term_field( 'name', $c-&gt;name, $c-&gt;term_id, 'category', 'display' ) ) . '&lt;/a&gt;';
-                                                echo join( ', ', $out );
</del><ins>+                                        foreach ( $categories as $c ) {
+                                                $out[] = sprintf( '&lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;',
+                                                        add_query_arg( array( 'post_type' =&gt; $post-&gt;post_type, 'category_name' =&gt; $c-&gt;slug ), 'edit.php' ),
+                                                        esc_html( sanitize_term_field( 'name', $c-&gt;name, $c-&gt;term_id, 'category', 'display' ) )
+                                                );
+                                        }
+                                        echo join( ', ', $out );
</ins><span class="cx">                                 } else {
</span><span class="cx">                                         _e( 'Uncategorized' );
</span><span class="cx">                                 }
</span><span class="lines">@@ -676,8 +536,12 @@
</span><span class="cx">                                 $tags = get_the_tags( $post-&gt;ID );
</span><span class="cx">                                 if ( !empty( $tags ) ) {
</span><span class="cx">                                         $out = array();
</span><del>-                                        foreach ( $tags as $c )
-                                                $out[] = &quot;&lt;a href='edit.php?post_type={$post-&gt;post_type}&amp;amp;tag={$c-&gt;slug}'&gt; &quot; . esc_html( sanitize_term_field( 'name', $c-&gt;name, $c-&gt;term_id, 'post_tag', 'display' ) ) . '&lt;/a&gt;';
</del><ins>+                                        foreach ( $tags as $c ) {
+                                                $out[] = sprintf( '&lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;',
+                                                        add_query_arg( array( 'post_type' =&gt; $post-&gt;post_type, 'tag' =&gt; $c-&gt;slug ), 'edit.php' ),
+                                                        esc_html( sanitize_term_field( 'name', $c-&gt;name, $c-&gt;term_id, 'tag', 'display' ) )
+                                                );
+                                        }
</ins><span class="cx">                                         echo join( ', ', $out );
</span><span class="cx">                                 } else {
</span><span class="cx">                                         _e( 'No Tags' );
</span><span class="lines">@@ -690,6 +554,7 @@
</span><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;div class=&quot;post-com-count-wrapper&quot;&gt;
</span><span class="cx">                         &lt;?php
</span><ins>+                                $pending_comments = isset( $this-&gt;comment_pending_count[$post-&gt;ID] ) ? $this-&gt;comment_pending_count[$post-&gt;ID] : 0;
</ins><span class="cx">                                 $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
</span><span class="cx">                                 if ( $pending_comments )
</span><span class="cx">                                         echo '&lt;strong&gt;';
</span><span class="lines">@@ -710,28 +575,15 @@
</span><span class="cx"> 
</span><span class="cx">                         case 'author':
</span><span class="cx">                         ?&gt;
</span><del>-                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;a href=&quot;edit.php?post_type=&lt;?php echo $post-&gt;post_type; ?&gt;&amp;amp;author=&lt;?php the_author_meta( 'ID' ); ?&gt;&quot;&gt;&lt;?php the_author() ?&gt;&lt;/a&gt;&lt;/td&gt;
</del><ins>+                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;?php
+                                printf( '&lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;',
+                                        add_query_arg( array( 'post_type' =&gt; $post-&gt;post_type, 'author' =&gt; get_the_author_meta( 'ID' ) ), 'edit.php' ),
+                                        get_the_author()
+                                );
+                        ?&gt;&lt;/td&gt;
</ins><span class="cx">                         &lt;?php
</span><span class="cx">                         break;
</span><span class="cx"> 
</span><del>-                        case 'control_view':
-                        ?&gt;
-                        &lt;td&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; rel=&quot;permalink&quot; class=&quot;view&quot;&gt;&lt;?php _e( 'View' ); ?&gt;&lt;/a&gt;&lt;/td&gt;
-                        &lt;?php
-                        break;
-
-                        case 'control_edit':
-                        ?&gt;
-                        &lt;td&gt;&lt;?php if ( current_user_can( $post_type_object-&gt;cap-&gt;edit_post, $post-&gt;ID ) ) { echo &quot;&lt;a href='$edit_link' class='edit'&gt;&quot; . __( 'Edit' ) . &quot;&lt;/a&gt;&quot;; } ?&gt;&lt;/td&gt;
-                        &lt;?php
-                        break;
-
-                        case 'control_delete':
-                        ?&gt;
-                        &lt;td&gt;&lt;?php if ( current_user_can( $post_type_object-&gt;cap-&gt;delete_post, $post-&gt;ID ) ) { echo &quot;&lt;a href='&quot; . wp_nonce_url( &quot;post.php?action=delete&amp;amp;post=$id&quot;, 'delete-post_' . $post-&gt;ID ) . &quot;' class='delete'&gt;&quot; . __( 'Delete' ) . &quot;&lt;/a&gt;&quot;; } ?&gt;&lt;/td&gt;
-                        &lt;?php
-                        break;
-
</del><span class="cx">                         default:
</span><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;?php do_action( 'manage_posts_custom_column', $column_name, $post-&gt;ID ); ?&gt;&lt;/td&gt;
</span></span></pre>
</div>
</div>

</body>
</html>