javascript won't load in header
-
I need this JS to be loaded in the header, but no matter what I do, it’s still loaded at the bottom of the page.
Here’s the set up of theme-functions.php:
function ct_register_cssjs() { wp_register_script('gmaps', 'https://maps.google.com/maps/api/js?sensor=false', '', '1.0', false); wp_register_script('marker', get_template_directory_uri() . '/js/markerwithlabel.js', 'gmaps', '1.0', true); //other scripts cut for brevity } add_action('wp_enqueue_scripts', 'ct_register_cssjs'); function ct_init_scripts() { wp_enqueue_script('gmaps'); wp_enqueue_script('marker'); //more scripts.. } add_action('wp_enqueue_scripts', 'ct_init_scripts');
I need, but can’t get the gmaps script to be placed in the <head>
I’ve tried using blank space instead of false for $in_footer variable, but this hasn’t worked either.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘javascript won't load in header’ is closed to new replies.