Last active
August 29, 2015 14:25
-
-
Save mattmcgiv/dd8bd30745a80209306f to your computer and use it in GitHub Desktop.
enqueue javascript in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| wp_enqueue_script('whatev-handle', __FILE__ . '/js/script.js', 'jquery', true); | |
| /* | |
| * Usage: | |
| * wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); | |
| * | |
| * @param string $handle Name of the script. | |
| * @param string|bool $src Path to the script from the root directory of WordPress. Example: '/js/myscript.js'. | |
| * @param array $deps An array of registered handles this script depends on. Default empty array. | |
| * @param string|bool $ver Optional. String specifying the script version number, if it has one. This parameter | |
| * is used to ensure that the correct version is sent to the client regardless of caching, | |
| * and so should be included if a version number is available and makes sense for the script. | |
| * @param bool $in_footer Optional. Whether to enqueue the script before </head> or before </body>. | |
| * Default 'false'. Accepts 'false' or 'true'. | |
| */ | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment