How to change background image from WordPress Gallery

The background image is applied to the <body> element, so using jQuery, all you really need to do is add a .click() handler to the $(‘dt.gallery-icon img’) element, grabbing its src attribute and applying it to the body’s background-image. EDIT: I thought this would be an interesting exercise, so here is a plugin that does … Read more

Extend the twentyten dropdown menu with jQuery with a delay onmouseout

The solution was very simple! Just use Superfish.js as instructed on http://users.tpg.com.au/j_birch/plugins/superfish/#getting-started Be sure to include superfish, hoverIntent and jQuery in your wordpress. In your custom js script file, something like this works like a charm: $(‘ul#theidofyourmenu’).superfish({ delay: 600, // This will fire up the hoverIntent autoArrows: false // Disable this if you don’t want … Read more

registering new jQuery after wp_deregister_script() not working

When setting your dependencies they need to be in an array. wp_register_script(‘jquery’, ‘http://code.jquery.com/jquery-1.7.min.js’, ‘1.7’, 1); wp_register_script(‘modernizr’, get_bloginfo(‘template_directory’).’/js/libs/modernizr-2.0.6.min.js’, array(‘jquery’) ); wp_register_script(‘plugins’, get_bloginfo(‘template_directory’).’/js/plugins.js’, array(‘jquery’), ”, 1); wp_register_script(‘custom’, get_bloginfo(‘template_directory’).’/js/script.js’, array( ‘jquery’) , ”, 1);

Adding URL of PDF from Thickbox in a Meta Box

This line… imgurl = jQuery(‘img’,html).attr(‘src’); Means that jQuery is getting the “source” (i.e. full path) of the image. As you’ve guessed, that won’t work for a PDF file. What you’ll probably have to do is get the id of the attachment instead. Could you possibly update your original answer with the HTML SOURCE of the … Read more

Changing WordPress URL breaks some jquery functions

There are PHP errors and notices in your scripts invalidating the JavaScript code: http://www.foxterrier.com/wp-content/themes/shape/smooths/getimages.php <b>Deprecated</b>: Function eregi() is deprecated in <b>/home/foxterrier/public_html/wp-content/themes/shape/smooths/getimages.php</b> on line <b>13</b><br /> smootharray[0]=”004.jpg”;<br /> Plus, you are loading jQuery too late. Read wp_enqueue_script() and how to handle dependencies (the third parameter).

Remove swfobject.js in wp_head()

if you have unwanted javascript on your page, it usually comes from plugins. deactivate them, and see if the javascript is still there. if it still is, try updating wordpress, or switching to another theme. if not, activate the plugins one by one, and check which one is putting this script to your head. after … Read more

How to add custon UI jquery & Fancybox script to WP

If you are not already loading the jQuery UI .js and .css files in your theme/plugin you can add them via the wp_enqueue_script function: http://codex.wordpress.org/Function_Reference/wp_enqueue_script No, add them via the enqueue scripts function. You need to wrap any inline scripts in a jQuery No Conflict wrapper. jQuery(document).ready(function($) { // do stuff // }); more on … Read more