hoogljo.blogg.se

Wp enqueue
Wp enqueue







You can remove it: // Removing all versions of all scripts (and styles):Īdd_filter( 'script_loader_src', '_remove_script_version' ) Īdd_filter( 'style_loader_src', '_remove_script_version' ) When registering a script, it gets a version (the current version of WordPress, by default): /wp-includes/css/?ver=4.9. #8 Remove a version of the script or style from the URL If due to the dependence on other scripts, there is no way to connect the current script in the footer, this parameter will be ignored.įor clear code, you may specify any string instead of true, for example, you can use 'in_footer'. Typically, a script is included in the of the document, if set to true, the script will be included before the tag (where the wp_footer() template tag is called). Whether to enqueue the script in the footer? If set to null, version adding will be skipped. If set to false, the current WordPress version will be used.

wp enqueue

The version is added to the URL as a query string for cache busting purposes. Scripts that must be loaded before this one.ĭefault: array() $ver (string/true/false/null) See below the list of all registered scripts by default (like jquery).ĭefault: '' $deps (array) An array of registered script handles this script depends on.

  • get_template_directory_uri() - for themes.Įxternal domains can be specified with implicit protocol ///js/their-script.js.
  • There's no need to specify a hardcoded path, use the following functions: This option is only needed when the script is not registered and WordPress is not yet aware of it and its path. $src (string)įull URL of the script, or path of the script relative to the WordPress root directory.

    wp enqueue

    So you can, for example, specify the version of the script. If the string contains a question mark (?): scriptaculous?v=1.2, then the preceding part will be the name of the script, and all that text after the question mark will be added to the URL as request parameters.

    wp enqueue

    Usage wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ) $handle (string) (required)









    Wp enqueue