Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @everyone: I found a solution. I’m not sure if this will comply with the best practices for wp_enqueue_spript(), but this is working for me now:

    I put my wp_enqueue_script() statements into the functions.php file of my theme; including the call for my own javascript file. What remains in the header.php is just <?php wp_head(); ?>

    Then in the functions.php:

    <?php
    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-ui-core');
    wp_enqueue_script( 'onLoad', '/wp-content/themes/my-theme/js/onLoad.js', array( 'jquery' ) );
    ?>

    Give it a go!

    Also, don’t forget that loading jQuery this way puts it into .noConflict(). So you need to either use the full “jQuery” object refrence (instead of “$”) or force some other variable, like I did:

    var $j = jQuery.noConflict();
    $j(document).ready(
    	function(){
    		footerSlider();
    		dropDownMenus();
    	});

    Best,
    Evan

    Hi All,
    I’m having the identical difficulty with enqueue. I chimed-in just to get email updates on this thread. If it helps anyone see anything new, here is my current (non-functional) snippet:

    <?php
    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-ui-core');
    wp_enqueue_script( 'onLoad', '/wp-content/themes/my-theme/js/onLoad.js', array( 'jquery' ) );
    wp_head();
    ?>

    I have also done the ‘my code in the header below wp_head()‘ test my script is fine. We’re missing something in translation here. Where is Otto when we need him?

    Evan

    This is great, but I don’t understand
    $page->ID;

    How would I pass the ID parameter of $page as an argument; for wp_list_pages(‘exclude=’) for example?

    cheers,
    Evan

Viewing 3 replies - 1 through 3 (of 3 total)