Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Add into functions.php of your child theme
- // Inline script
- add_action( 'wp_head', 'my_custom_js_in_head' );
- function my_custom_js_in_head() {
- ?>
- <script type="text/javascript" id="my-custom-js">
- // Your custom JS code here
- console.log('Custom JS loaded in the head!');
- </script>
- <?php
- }
- // Script with [src]
- add_action('wp_enqueue_scripts', 'my_enqueue_head_script');
- function my_enqueue_head_script() {
- wp_enqueue_script('my-custom-head-js', get_template_directory_uri() . '/js/my-script.js', array(), null, false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement