LLMS_Assets::enqueue_script( string $handle )

Enqueue (and maybe register) a defined script


Description Description

If the script has not yet been registered, it will be automatically registered.

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 definitions list via the LLMS_Assets::define() method.
  • 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 because registration will fail.


Top ↑

Parameters Parameters

$handle

(string) (Required) The script's handle.


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: includes/class-llms-assets.php

197
198
199
200
201
202
203
204
205
206
207
208
* @return boolean
 */
public function enqueue_script( $handle ) {
 
    // Script was not registered and registration failed.
    if ( ! wp_script_is( $handle, 'registered' ) && ! $this->register_script( $handle ) ) {
        return false;
    }
 
    wp_enqueue_script( $handle );
 
    return wp_script_is( $handle, 'enqueued' );


Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.