How to remove js ui library added by default by wordpress

The related library is registered with a function called wp_default_scripts. File location (for WordPress 6.0): …wp-includes/script-loader.php remove to remove the relevant script; The add function is used to add a new script. /** * Assigns default styles to $styles object. * * Nothing is returned, because the $styles parameter is passed by reference. * Meaning … Read more

Best way of getting a a series of custom fields into an array?

This way of wokring with slides seems to be as popular as it is terrible… 🙂 I coded something very much like this recently. Basic idea, adjust as needed: $id = get_the_ID(); $slides = array(); $i = 1; foreach( get_post_custom_keys( $id ) as $key ) if ( false !== strpos( $key, ‘slide’ ) ) $slides[$key] … Read more

Problem Implementing parallax in header of bp-default theme

First off — When including Javascript, use a function hooked to the init action in functions.php. See: http://scribu.net/wordpress/optimal-script-loading.html Secondly — The CSS for the BP bar is being effected by something in your theme. If fixing how your Javascript is loading first doesn’t fix that issue, try selecting that object in Firebug (Or Chrome’s developer … Read more

Loading dynamic content with AJAX breaking jQuery

So if you say there are no errors, I’m assumming that your problem is the AJAX request changing the DOM, and your scripts being loaded before that. If the document changes, you’ll need to tell your scripts that, so they will fire their events on the new content. So: Either you reload all scripts again … Read more

Having trouble setting / modifying cookies

if (getCookie($(this).attr(“id”)) == true) { The above code will NEVER evaluate as true because cookie values are stored as strings. You are trying to store a boolean value, which is converted to a string when it is written to the cookie. When the browser reads the cookie value, it is also read as a string. … Read more

Loading a newer version of jQuery within WordPress

To replace the default jQuery url, do: wp_deregister_script( ‘jquery’ ); wp_register_script( ‘jquery’, ‘your custom url’, … ); Then call wp_enqueue_script( ‘jquery’ ); as usual. Note that various pages in the WP admin might not be compatible with never versions of jQuery, not to mention plugin scripts.

How to add drag and drop functionalities to a div inside option panel

3 steps: php <?php wp_enqueue_script( ‘jquery-ui-sortable’); html <div class=”metabox-holder”> <div class=”postbox-container”> <div id=”my_div” class=”meta-box-sortables ui-sortable”> <div class=”postbox” id=”el1″> <h3 class=”hndle”><span>title2</span></h3> <div class=”inside”>content1</div> </div> […elements…] <div class=”postbox” id=”el20″> <h3 class=”hndle”><span>title20</span></h3> <div class=”inside”>content1</div> </div> </div> </div> javascript <script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(‘#my_div’).sortable(); });