WP_Styles::print_inline_style()publicWP 3.3.0

Prints extra CSS styles of a registered stylesheet.

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

Хуков нет.

Возвращает

Строку|true|false. False if no data exists, inline styles if $display is true, true otherwise.

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

global $wp_styles;
$wp_styles->print_inline_style( $handle, $display );
$handle(строка) (обязательный)
The style's registered handle.
$display(true|false)
Whether to print the inline style instead of just returning it.
По умолчанию: true

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

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

Код WP_Styles::print_inline_style() WP 6.5.2

public function print_inline_style( $handle, $display = true ) {
	$output = $this->get_data( $handle, 'after' );

	if ( empty( $output ) ) {
		return false;
	}

	$output = implode( "\n", $output );

	if ( ! $display ) {
		return $output;
	}

	printf(
		"<style id='%s-inline-css'%s>\n%s\n</style>\n",
		esc_attr( $handle ),
		$this->type_attr,
		$output
	);

	return true;
}