I've read the codex section on wp-enqeue, but am still struggling.
Basically, I would like to get the following to display properly in my theme's widget area (on every page):
<link rel="stylesheet" type="text/css" href="/wp-content/uploads/social_counter/css/styles.css" />
<link rel="stylesheet" type="text/css" href="/wp-content/uploads/social_counter/css/tipTip.css" />
<div id="social_counter">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js"></script>
<script type="text/javascript" src="/wp-content/uploads/social_counter/js/social_counter.js"></script>
</div>
I created a text widget into which I pasted the code, but it breaks a few things in the template as there is likely a conflict since jquery is already loaded by the theme and/ or other plugins.
Could someone show me how to best form this using wp_enqueue, and where to paste the subsequent code (functions.php of theme?)?
Thanks.
I've tried the following:
if(!is_admin()){
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js',false);
wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/social_counter.js',array('jquery'),'1.4.2',false);
}
It seem to load two of the scripts when I view the page source, but not the google jquery, and the content does not show...
now i have the following, still nothing (two scripts show up, but not the google jquery):
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
wp_enqueue_script( 'jquery' );
wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js',false);
wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/social_counter.js',array('jquery'),'1.4.2',false);
Latest Edit.. (i really wish stack overflow would adopt a mroe user-friendly threading system :/ )
function add_scripts(){
// Load jQuery
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);
wp_enqueue_script('jquery');
}
// Your Scripts
wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js',false);
wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/social_counter.js',array('jquery'),'1.4.2',false);
}
add_action('init','add_scripts');