WPSEO_Meta_Columns::posts_filter_dropdown()publicYoast 1.0

Adds a dropdown that allows filtering on the posts SEO Quality.

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

Хуков нет.

Возвращает

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

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

$WPSEO_Meta_Columns = new WPSEO_Meta_Columns();
$WPSEO_Meta_Columns->posts_filter_dropdown();

Код WPSEO_Meta_Columns::posts_filter_dropdown() Yoast 23.5

public function posts_filter_dropdown() {
	if ( ! $this->can_display_filter() ) {
		return;
	}

	$ranks = WPSEO_Rank::get_all_ranks();

	/* translators: Hidden accessibility text. */
	echo '<label class="screen-reader-text" for="wpseo-filter">' . esc_html__( 'Filter by SEO Score', 'wordpress-seo' ) . '</label>';
	echo '<select name="seo_filter" id="wpseo-filter">';

	// phpcs:ignore WordPress.Security.EscapeOutput -- Output is correctly escaped in the generate_option() method.
	echo $this->generate_option( '', __( 'All SEO Scores', 'wordpress-seo' ) );

	foreach ( $ranks as $rank ) {
		$selected = selected( $this->get_current_seo_filter(), $rank->get_rank(), false );

		// phpcs:ignore WordPress.Security.EscapeOutput -- Output is correctly escaped in the generate_option() method.
		echo $this->generate_option( $rank->get_rank(), $rank->get_drop_down_label(), $selected );
	}

	echo '</select>';
}