Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End can’t embed scripts in WordPress

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30345
    EricM
    Member

    I can’t get jquery in my wordpress theme. I’m starting with a blank starkers theme with my database loaded. I can get my own scripts loaded, but once I try to embed jquery, they disappear. Here’s what I have in my header.php

    
    /**
    * The Header for our theme.
    *
    * Displays all of the section and everything up till

    *
    * @package WordPress
    * @subpackage Starkers
    * @since Starkers 3.0
    */
    ?>
    >


    <?php wp_title( '|', true, 'right' ); ?>




    wp_enqueue_script( 'comment-reply' );
    wp_head();
    ?>





    I haven’t touched anything outside the head tag. I also tried to load use google api by putting this at the bottom of my functions.php file:

    if( !is_admin()){
    wp_deregister_script('jquery');
    wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"), false, '1.4.2');
    wp_enqueue_script('jquery');
    }

    I’m not sure if that is supposed to be wrapped in php tags, but it failed both ways. I might just have to download a theme that’s already running jquery, but that will be a lot more work. What am I missing?

    #79134
    EricM
    Member

    Oops, forgot, this is at http://ericmontzka.com/may10wordpress.

    #79104
    TheDoc
    Member

    From Chris’ other site, Digging Into WordPress:

    “Including jQuery in WordPress (The Right Way)”
    http://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/

    #79109
    EricM
    Member

    Thanks Doc, that’s where I got the above code. I also tried this from codex at http://codex.wordpress.org/Function_Reference/wp_enqueue_script :


    function my_init_method() {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js');
    }

    add_action('init', 'my_init_method');
    ?>
    #79110
    TheDoc
    Member

    What do you mean when you say “the other scripts disappear”?

    #79111
    EricM
    Member

    …in the source code. I embed my own scripts and view source, and they are in there. I try to embed jquery in any of the ways mentioned above, and none of the scripts are there, although I just viewed safari and my non-jquery scripts are there, but nothing is in Firefox.
    BTW, I just checked Opera and Chrome, they also have my scripts, but no jquery. So I guess the disappearing is just a firefox thing right now, which might clear up once I figure out the jquery problem.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.