- This topic is empty.
-
AuthorPosts
-
September 24, 2010 at 11:56 am #30345EricMMember
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
*/
?>
>
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?
September 24, 2010 at 12:00 pm #79134EricMMemberOops, forgot, this is at http://ericmontzka.com/may10wordpress.
September 24, 2010 at 12:13 pm #79104TheDocMemberFrom 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/September 24, 2010 at 2:36 pm #79109EricMMemberThanks 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');
?>September 24, 2010 at 2:54 pm #79110TheDocMemberWhat do you mean when you say “the other scripts disappear”?
September 24, 2010 at 3:15 pm #79111EricMMember…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. -
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.