WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_List_Table::print_column_headers() public WP 3.1.0

Prints column headers, accounting for hidden and sortable columns.

Это метод класса: WP_List_Table{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WP_List_Table = new WP_List_Table();
$WP_List_Table->print_column_headers( $with_id );
$with_id(true/false)
Whether to set the ID attribute or not
По умолчанию: true

Список изменений

С версии 3.1.0 Введена.

Код WP_List_Table::print_column_headers() WP 5.5.1

wp-admin/includes/class-wp-list-table.php
<?php
public function print_column_headers( $with_id = true ) {
	list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();

	$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
	$current_url = remove_query_arg( 'paged', $current_url );

	if ( isset( $_GET['orderby'] ) ) {
		$current_orderby = $_GET['orderby'];
	} else {
		$current_orderby = '';
	}

	if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
		$current_order = 'desc';
	} else {
		$current_order = 'asc';
	}

	if ( ! empty( $columns['cb'] ) ) {
		static $cb_counter = 1;
		$columns['cb']     = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
			. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
		$cb_counter++;
	}

	foreach ( $columns as $column_key => $column_display_name ) {
		$class = array( 'manage-column', "column-$column_key" );

		if ( in_array( $column_key, $hidden, true ) ) {
			$class[] = 'hidden';
		}

		if ( 'cb' === $column_key ) {
			$class[] = 'check-column';
		} elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
			$class[] = 'num';
		}

		if ( $column_key === $primary ) {
			$class[] = 'column-primary';
		}

		if ( isset( $sortable[ $column_key ] ) ) {
			list( $orderby, $desc_first ) = $sortable[ $column_key ];

			if ( $current_orderby === $orderby ) {
				$order = 'asc' === $current_order ? 'desc' : 'asc';

				$class[] = 'sorted';
				$class[] = $current_order;
			} else {
				$order = strtolower( $desc_first );

				if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) {
					$order = $desc_first ? 'desc' : 'asc';
				}

				$class[] = 'sortable';
				$class[] = 'desc' === $order ? 'asc' : 'desc';
			}

			$column_display_name = sprintf(
				'<a href="%s"><span>%s</span><span class="sorting-indicator"></span></a>',
				esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ),
				$column_display_name
			);
		}

		$tag   = ( 'cb' === $column_key ) ? 'td' : 'th';
		$scope = ( 'th' === $tag ) ? 'scope="col"' : '';
		$id    = $with_id ? "id='$column_key'" : '';

		if ( ! empty( $class ) ) {
			$class = "class='" . join( ' ', $class ) . "'";
		}

		echo "<$tag $scope $id $class>$column_display_name</$tag>";
	}
}