WP_Styles::print_inline_style

Advertisement

Summery Summery

Prints extra CSS styles of a registered stylesheet.

Syntax Syntax

WP_Styles::print_inline_style( string $handle, bool $echo = true )

Parameters Parameters

$handle

(Required) The style's registered handle.

$echo

(Optional) Whether to echo the inline style instead of just returning it.

Default value: true

Return Return

(string|bool) False if no data exists, inline styles if $echo is true, true otherwise.

Source Source

File: wp-includes/class.wp-styles.php

	 * @return string|bool False if no data exists, inline styles if `$echo` is true,
	 *                     true otherwise.
	 */
	public function print_inline_style( $handle, $echo = true ) {
		$output = $this->get_data( $handle, 'after' );

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

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

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

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

Advertisement

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.

Advertisement

Leave a Reply