WP_Screen::render_list_table_columns_preferences()publicWP 4.4.0

Renders the list table columns preferences.

Метод класса: WP_Screen{}

Хуков нет.

Возвращает

null. Ничего (null).

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

$WP_Screen = new WP_Screen();
$WP_Screen->render_list_table_columns_preferences();

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

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

Код WP_Screen::render_list_table_columns_preferences() WP 6.5.2

<?php
public function render_list_table_columns_preferences() {

	$columns = get_column_headers( $this );
	$hidden  = get_hidden_columns( $this );

	if ( ! $columns ) {
		return;
	}

	$legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' );
	?>
	<fieldset class="metabox-prefs">
	<legend><?php echo $legend; ?></legend>
	<?php
	$special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' );

	foreach ( $columns as $column => $title ) {
		// Can't hide these for they are special.
		if ( in_array( $column, $special, true ) ) {
			continue;
		}

		if ( empty( $title ) ) {
			continue;
		}

		/*
		 * The Comments column uses HTML in the display name with some screen
		 * reader text. Make sure to strip tags from the Comments column
		 * title and any other custom column title plugins might add.
		 */
		$title = wp_strip_all_tags( $title );

		$id = "$column-hide";
		echo '<label>';
		echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden, true ), true, false ) . ' />';
		echo "$title</label>\n";
	}
	?>
	</fieldset>
	<?php
}