Usage
nebula()->register_script($handle, $src, $exec, $deps, $ver, $in_footer)
Parameters
$handle
(Required) (String) The unique name of the script
Default: None
$src
(Required) (String) The file URI of the script
Default: None
$exec
(Optional) (String) Async or Defer
Default: None
$deps
(Optional) (Array) Array of script dependencies
Default: None
$ver
(Optional) (String) Version number of the script
Default: false
$in_footer
(Optional) (Boolean) Whether to load the script in the footer
Default: false
Parameter Notes
All of these parameters are the exact same as wp_register_script() except with the addition of $exec.
Examples
nebula()->register_script('nebula-main', get_template_directory_uri() . '/assets/js/main.js', 'defer', array('nebula-bootstrap', 'jquery', 'nebula-jquery_ui'), null, true);
Source File
Located in /libs/Optimization.php on line 160.
No Hooks
This function does not have any filters or actions available. Request one?Note: This function contains 1 to-do comment.
public function register_script($handle=null, $src=null, $attributes=array(), $deps=array(), $ver=false, $in_footer=false){ wp_register_script($handle, $src, $deps, $ver, $in_footer); //@todo "Nebula" 0: Update this to use the new syntax as of WP 6.3 if ( !empty($attributes) ){ $attributes = ( is_array($attributes) )? $attributes : array($attributes); //Make sure it is an array foreach ( $attributes as $attribute ){ $is_data_added = wp_script_add_data($handle, $attribute, true); } } }
Override
This function can not be short-circuited with an override filter. Request one?