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

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

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

    Thanks in advice,
    Simone

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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).

    Thread Starter simbian

    (@simbian)

    thanks for the explanation!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘scripts not loaded in the footer’ is closed to new replies.