WordPress.org

Ready to get started?Download WordPress

Forums

wp enqueue not showing (10 posts)

  1. emaarkhan
    Member
    Posted 1 year ago #

    hi,,
    i am enqueuing jquery in my funcitions files but it doesn't show when i see my source of the page. i m trying to load jquery whch is test just by calling a alert bt upon checking many times, i saw the source didn't had query enqueue in the page. wht can i do?

  2. Peter_L
    Member
    Posted 1 year ago #

    This is all you need in your function to load jquery.

    <?php
    function load_jquery(){
        wp_enqueue_script('jquery');
    }
    add_action('wp_enqueue_scripts', 'load_jquery');
    ?>

    Also, make sure your header.php file has this line <?php wp_head(); ?>

  3. emaarkhan
    Member
    Posted 1 year ago #

    I do see a include of jquery from wp-includes. after my wp_head i included the file to my script i.e <script type="text/javascript" src="scripts/script.js"></script> which has code

    jQuery(document).ready(function(){
      alert('test');
    });

    still nothing pops up

  4. Peter_L
    Member
    Posted 1 year ago #

    Does the jQuery library get loaded now?

  5. emaarkhan
    Member
    Posted 1 year ago #

    yes it says

  6. Peter_L
    Member
    Posted 1 year ago #

    Ok, now step 2.
    Register your script, then enqueue it.

    Look at this example. (switch scriptaculous with jquery)
    Also, read this, http://codex.wordpress.org/Function_Reference/wp_register_script ,so you know what you're doing.

  7. emaarkhan
    Member
    Posted 1 year ago #

    i am n00b. can you gimme a example.i only know of wp_enqueue_script('jquery') how do i register my script?

  8. Peter_L
    Member
    Posted 1 year ago #

  9. emaarkhan
    Member
    Posted 1 year ago #

    thats too much for me to digest. i had dine the enqueue bt still its nt working

  10. emaarkhan
    Member
    Posted 1 year ago #

    help!

Topic Closed

This topic has been closed to new replies.

About this Topic