WP_Styles::print_inline_style() public WP 3.3.0
Prints extra CSS styles of a registered stylesheet.
{} It's a method of the class: WP_Styles{}
No Hooks.
Return
String/true/false. False if no data exists, inline styles if $echo is true, true otherwise.
Usage
global $wp_styles; $wp_styles->print_inline_style( $handle, $echo );
- $handle(string) (required)
- The style's registered handle.
- $echo(true/false)
- Whether to echo the inline style instead of just returning it.
Default: true
Changelog
Since 3.3.0 | Introduced. |
Code of WP_Styles::print_inline_style() WP Styles::print inline style WP 5.6
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
);
return true;
}