scripts not loaded in the footer (3 posts)

  1. simbian
    Posted 4 years ago #

    Hello everybody, i put that code to my functions.php

    function add_jquery_tools() {
    	if ( !is_admin() ) {
    		wp_register_script('addons_script', 'http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js', array('jquery'), 'true');
    	if ( !is_admin() ) {
    		wp_register_script('addons_javascript', 'https://apis.google.com/js/plusone.js', true, '');
    add_action('wp_print_scripts', 'add_jquery_tools');

    but both the script i see that are loaded in the head, see HTML source of http://www.digitalking.it instead of footer, even if i set the variable $in_footer to true according to Codex http://codex.wordpress.org/Function_Reference/wp_enqueue_script
    what's wrong?

    Thanks in advice,

  2. Mark / t31os
    Posted 4 years ago #

    The first script has jQuery as a dependancy, if another script also has jQuery as a dependancy, and said script loads in the head, then as a result, so will yours.

    The second script does not set the in footer parameter to true, so naturally it appears in the head(the third paramter is set to true, which is for dependancies - and the fourth which is the with footer paramter is an empty string).

  3. simbian
    Posted 4 years ago #

    thanks for the explanation!

Topic Closed

This topic has been closed to new replies.

About this Topic