Forums

Why is wp_enqueue_script() loading scripts in footer? (3 posts)

  1. KerriM
    Member
    Posted 3 years ago #

    I have the following code in my header.php file:

    <?php wp_enqueue_script("jquery"); ?>
    <?php if(is_page_template('page-portfolio.php')){
    	wp_enqueue_script('jquery-ui-core');
    	wp_enqueue_script('jquery-ui-tabs');
    }
    ?>

    jquery-ui-core and jquery-ui-tabs are loading in the footer of the page, however, nowhere do I have $in_footer set to true. Any clues as to why this could be happening?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    http://comox.textdrive.com/pipermail/wp-hackers/2008-March/018980.html perhaps?

    Try something like:

    function init_tabs() {
        add jquery-ui-core();
        add jquery-ui-tabs();
    }
    if(is_page_template('page-portfolio.php')) add_action('init', 'init_tabs');

    in functions.php

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress

  3. KerriM
    Member
    Posted 3 years ago #

    Ah, thanks! That's helpful.

Topic Closed

This topic has been closed to new replies.

About this Topic