Definition:
function display_page_row( $page, $level = 0 ) {}
Parameters
- unknown_type $page
- unknown_type $level
Defined filters
- post_date_column_time
apply_filters('post_date_column_time', $h_time, $page, $column_name, '')
- page_row_actions
apply_filters('page_row_actions', $actions, $page)
Defined actions
- manage_pages_custom_column
do_action('manage_pages_custom_column', $column_name, $id);
Source code
function display_page_row( $page, $level = 0 ) { global $post, $current_screen; static $rowclass; $post = $page; setup_postdata($page); if ( 0 == $level && (int)$page->post_parent > 0 ) { //sent level 0 by accident, by default, or because we don't know the actual level $find_main_page = (int)$page->post_parent; while ( $find_main_page > 0 ) { $parent = get_page($find_main_page); if ( is_null($parent) ) break; $level++; $find_main_page = (int)$parent->post_parent; if ( !isset($parent_name) ) $parent_name = $parent->post_title; } } $page->post_title = esc_html( $page->post_title ); $pad = str_repeat( '— ', $level ); $id = (int) $page->ID; $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; $posts_columns = get_column_headers( $current_screen ); $hidden = get_hidden_columns( $current_screen ); $title = _draft_or_post_title(); $post_type = $page->post_type; $post_type_object = get_post_type_object($post_type); ?> <tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit"> <?php foreach ( $posts_columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': ?> <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->cap->edit_post, $page->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th> <?php break; case 'date': if ( '0000-00-00 00:00:00' == $page->post_date && '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->post_date; $time = get_post_time('G', true); $time_diff = time() - $time; if ( $time_diff > 0 && $time_diff < 24*60*60 ) $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); else $h_time = mysql2date(__('Y/m/d'), $m_time); } echo '<td ' . $attributes . '>'; echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>'; echo '<br />'; if ( 'publish' == $page->post_status ) { _e('Published'); } elseif ( 'future' == $page->post_status ) { if ( $time_diff > 0 ) echo '<strong class="attention">' . __('Missed schedule') . '</strong>'; else _e('Scheduled'); } else { _e('Last Modified'); } echo '</td>'; break; case 'title': $attributes = 'class="post-title page-title column-title"' . $style; $edit_link = get_edit_post_link( $page->ID ); ?> <td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?></strong> <?php $actions = array(); if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; } if ( current_user_can($post_type_object->cap->delete_post, $page->ID) ) { if ( $post->post_status == 'trash' ) $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&action=untrash&post=$page->ID", 'untrash-' . $post->post_type . '_' . $page->ID) . "'>" . __('Restore') . "</a>"; elseif ( EMPTY_TRASH_DAYS ) $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>"; if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS ) $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&action=delete&post=$page->ID", 'delete-' . $post->post_type . '_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>"; } if ( in_array($post->post_status, array('pending', 'draft')) ) { if ( current_user_can($post_type_object->cap->edit_post, $page->ID) ) $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink($page->ID) ) ) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } elseif ( $post->post_status != 'trash' ) { $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } $actions = apply_filters('page_row_actions', $actions, $page); $action_count = count($actions); $i = 0; echo '<div class="row-actions">'; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; echo "<span class='$action'>$link$sep</span>"; } echo '</div>'; get_inline_data($post); echo '</td>'; break; case 'comments': ?> <td <?php echo $attributes ?>><div class="post-com-count-wrapper"> <?php $left = get_pending_comments_num( $page->ID ); $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); if ( $left ) echo '<strong>'; comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>'); if ( $left ) echo '</strong>'; ?> </div></td> <?php break; case 'author': ?> <td <?php echo $attributes ?>><a href="edit.php?post_type=<?php echo $post_type; ?>&author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td> <?php break; default: ?> <td <?php echo $attributes ?>><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td> <?php break; } } ?> </tr> <?php }
922
No comments yet... Be the first to leave a reply!