LLMS_Assets::register_script( string $handle )
Registers a defined script with WordPress
Description Description
The script must be defined in one of the following places:
- The script definition list found at includes/assets/llms-assets-scripts.php
- Added to the definition list via the
llms_get_script_asset_definitions
filter - Added "just in time" via the
llms_get_script_asset
filter.
If the script is not defined this function will return false
.
Parameters Parameters
- $handle
-
(string) (Required) The script's handle.
Return Return
(boolean)
Source Source
File: includes/class-llms-assets.php
* @return boolean */ public function register_script( $handle ) { $script = $this->get( 'script', $handle ); if ( $script ) { array_map( array( $this, 'register_script' ), $script['dependencies'] ); $reg = wp_register_script( $handle, $script['src'], $script['dependencies'], $script['version'], $script['in_footer'] ); if ( $reg && $script['translate'] ) { $this->set_script_translations( $script ); } 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.9.0 | Automatically set script translations when translate=true . |
4.4.0 | Introduced. |