On this page
WP_Styles::print_inline_style( string $handle, bool $display = true ): string|bool
Prints extra CSS styles of a registered stylesheet.
Parameters
$handlestring Required-
The style's registered handle.
$displaybool Optional-
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
File: wp-includes/class-wp-styles.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| esc_attr() wp-includes/formatting.php | Escaping for HTML attributes. |
Used By
| Used By | Description |
|---|---|
| WP_Styles::do_item() wp-includes/class-wp-styles.php | Processes a style dependency. |
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_styles/print_inline_style