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

In this article

Prints extra CSS styles of a registered stylesheet.

Parameters

$handlestringrequired
The style’s registered handle.
$displaybooloptional
Whether to print the inline style instead of just returning it.

Default:true

Return

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

Source

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;
}

Changelog

VersionDescription
3.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.