page_css_class хук-фильтрWP 2.8.0

Filters the list of CSS classes to include with each page item in the list.

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

add_filter( 'page_css_class', 'wp_kama_page_css_class_filter', 10, 5 );

/**
 * Function for `page_css_class` filter-hook.
 * 
 * @param string[] $css_class       An array of CSS classes to be applied to each list item.
 * @param WP_Post  $page            Page data object.
 * @param int      $depth           Depth of page, used for padding.
 * @param array    $args            An array of arguments.
 * @param int      $current_page_id ID of the current page.
 *
 * @return string[]
 */
function wp_kama_page_css_class_filter( $css_class, $page, $depth, $args, $current_page_id ){

	// filter...
	return $css_class;
}
$css_class(string[])
An array of CSS classes to be applied to each list item.
$page(WP_Post)
Page data object.
$depth(int)
Depth of page, used for padding.
$args(массив)
An array of arguments.
$current_page_id(int)
ID of the current page.

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

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

Где вызывается хук

Walker_Page::start_el()
page_css_class
wp-includes/class-walker-page.php 159
$css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page_id ) );

Где используется хук в WordPress

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