WP_Posts_List_Table::single_row() WordPress Method
The WP_Posts_List_Table::single_row() method is used to display a single row of data for a post in the WordPress Posts list table. This method takes a single argument, which is an object that represents the post. This method first calls the WP_Posts_List_Table::_display_rows() method to display the post data. Next, it calls the WP_Posts_List_Table::single_row_actions() method to display the actions for the post. Finally, it calls the WP_Posts_List_Table::handle_row_actions() method to handle the actions for the post.
WP_Posts_List_Table::single_row( int|WP_Post $post, int $level ) #
Parameters
- $post
(int|WP_Post)(Required)
- $level
(int)(Required)
Source
File: wp-admin/includes/class-wp-posts-list-table.php
public function single_row( $post, $level = 0 ) {
$global_post = get_post();
$post = get_post( $post );
$this->current_level = $level;
$GLOBALS['post'] = $post;
setup_postdata( $post );
$classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' );
$lock_holder = wp_check_post_lock( $post->ID );
if ( $lock_holder ) {
$classes .= ' wp-locked';
}
if ( $post->post_parent ) {
$count = count( get_post_ancestors( $post->ID ) );
$classes .= ' level-' . $count;
} else {
$classes .= ' level-0';
}
?>
<tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
<?php $this->single_row_columns( $post ); ?>
</tr>
<?php
$GLOBALS['post'] = $global_post;
}
Expand full source codeCollapse full source codeView on TracView on GitHub