davillan
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Fixing WordPress
In reply to: How to load specific java script on specific page?Glad i could help –> jgrietveld
Forum: Fixing WordPress
In reply to: How to load specific java script on specific page?not sure if you have figured out the wp_enqueue out yet but i will post this for you and others
This code goes in your functions.php file
function scripts() { if ( !is_admin() ) { // this if statement will insure the following code only gets added to your wp site and not the admin page cause your code has no business in the admin page right unless that's your intentions // jquery wp_deregister_script('jquery'); // this deregisters the current jquery included in wordpress wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"), false); // this registers the replacement jquery wp_enqueue_script('jquery'); // you can either let wp insert this for you or just delete this and add it directly to your template // your own script wp_register_script('yourscript', ( get_bloginfo('template_url') . '/yourscript.js'), false); //first register your custom script wp_enqueue_script('swfobject'); // then let wp insert it for you or just delete this and add it directly to your template // just in case your also interested wp_register_script('yourJqueryScript', ( get_bloginfo('template_url') . '/yourJquery.js'), array('jquery')); // this last part-( array('jquery') )is added in case your script needs to be included after jquery wp_enqueue_script('yourJqueryScript'); // then print. it will be added after jquery is added } } add_action( 'wp_print_scripts', 'scripts'); // now just run the function
Viewing 2 replies - 1 through 2 (of 2 total)