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

WP_Screen::render_view_mode() public WP 4.4.0

Render the list table view mode preferences.

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

Хуки из метода
Возвращает

Null. Ничего.

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

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

Заметки

  • Global. Строка. $mode List table view mode.

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

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

Код WP Screen::render view mode: wp-admin/includes/class-wp-screen.php WP 5.5.1

<?php
public function render_view_mode() {
	global $mode;

	$screen = get_current_screen();

	// Currently only enabled for posts and comments lists.
	if ( 'edit' !== $screen->base && 'edit-comments' !== $screen->base ) {
		return;
	}

	$view_mode_post_types = get_post_types( array( 'show_ui' => true ) );

	/**
	 * Filters the post types that have different view mode options.
	 *
	 * @since 4.4.0
	 *
	 * @param string[] $view_mode_post_types Array of post types that can change view modes.
	 *                                       Default post types with show_ui on.
	 */
	$view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );

	if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) {
		return;
	}

	if ( ! isset( $mode ) ) {
		$mode = get_user_setting( 'posts_list_mode', 'list' );
	}

	// This needs a submit button.
	add_filter( 'screen_options_show_submit', '__return_true' );
	?>
	<fieldset class="metabox-prefs view-mode">
		<legend><?php _e( 'View mode' ); ?></legend>
		<label for="list-view-mode">
			<input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> />
			<?php _e( 'Compact view' ); ?>
		</label>
		<label for="excerpt-view-mode">
			<input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked( 'excerpt', $mode ); ?> />
			<?php _e( 'Extended view' ); ?>
		</label>
	</fieldset>
	<?php
}