WP_Comments_List_Table::display()publicWP 3.1.0

Displays the comments table.

Overrides the parent display() method to render extra comments.

Method of the class: WP_Comments_List_Table{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Comments_List_Table = new WP_Comments_List_Table();
$WP_Comments_List_Table->display();

Changelog

Since 3.1.0 Introduced.

WP_Comments_List_Table::display() code WP 6.5.2

<?php
public function display() {
	wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' );
	static $has_items;

	if ( ! isset( $has_items ) ) {
		$has_items = $this->has_items();

		if ( $has_items ) {
			$this->display_tablenav( 'top' );
		}
	}

	$this->screen->render_screen_reader_content( 'heading_list' );

	?>
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
	<?php
	if ( ! isset( $_GET['orderby'] ) ) {
		// In the initial view, Comments are ordered by comment's date but there's no column for that.
		echo '<caption class="screen-reader-text">' .
		/* translators: Hidden accessibility text. */
		__( 'Ordered by Comment Date, descending.' ) .
		'</caption>';
	} else {
		$this->print_table_description();
	}
	?>
<thead>
<tr>
	<?php $this->print_column_headers(); ?>
</tr>
</thead>

<tbody id="the-comment-list" data-wp-lists="list:comment">
	<?php $this->display_rows_or_placeholder(); ?>
</tbody>

<tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;">
	<?php
		/*
		 * Back up the items to restore after printing the extra items markup.
		 * The extra items may be empty, which will prevent the table nav from displaying later.
		 */
		$items       = $this->items;
		$this->items = $this->extra_items;
		$this->display_rows_or_placeholder();
		$this->items = $items;
	?>
</tbody>

<tfoot>
<tr>
	<?php $this->print_column_headers( false ); ?>
</tr>
</tfoot>

</table>
	<?php

	$this->display_tablenav( 'bottom' );
}