LLMS_Assets::register_style( string $handle )
Register a defined stylesheet
Description Description
If the stylesheet has not yet been registered, it will be automatically registered.
The stylesheet must be defined in one of the following places:
- The stylesheet definition list found at includes/assets/llms-assets-styles.php
- Added to the definition list via the
llms_get_style_asset_definitions
filter - Added "just in time" via the
llms_get_style_asset
filter.
If the stylesheet is not defined this function will return false
.
This method will also automatically add RTL style data unless explicitly told not to do so.
The RTL stylesheet should have the same name (and suffix) with -rtl
included prior to the suffix, for example llms.css
(or llms.min.css
) would add the RTL stylesheet llms-rtl.css
(or llms-rtl.min.css
).
Parameters Parameters
- $handle
-
(string) (Required) The stylesheets's handle.
Return Return
(boolean)
Source Source
File: includes/class-llms-assets.php
* @return boolean */ public function register_style( $handle ) { $style = $this->get( 'style', $handle ); if ( $style ) { array_map( array( $this, 'register_style' ), $style['dependencies'] ); $reg = wp_register_style( $handle, $style['src'], $style['dependencies'], $style['version'], $style['media'] ); if ( $reg && $style['rtl'] ) { wp_style_add_data( $handle, 'rtl', 'replace' ); wp_style_add_data( $handle, 'suffix', $style['suffix'] ); } return $reg; } return false;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.5.0 | Automatically register all of the asset's dependencies. |
4.4.0 | Introduced. |