WP_Styles::print_inline_style() WordPress Method
The WP_Styles::print_inline_style() method is used to print inline styles for a specific Wordpress stylesheet. This is useful for adding styles that are not present in the main stylesheet, or for overriding existing styles.
WP_Styles::print_inline_style( string $handle, bool $display = true ) #
Prints extra CSS styles of a registered stylesheet.
Parameters
- $handle
(string)(Required)The style's registered handle.
- $display
(bool)(Optional) Whether to print the inline style instead of just returning it.
Default value: 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
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |