Using jquery migrate for plugins incompatible with jquery 1.10.2

You have a syntax error in your wp_register_script() call: wp_register_script(‘curtain-instance’, get_stylesheet_directory_uri().’/curtain-instance.min.js’, array(‘curtain’,’jquery’,’jquery-migrate’), true ); You’re missing the version parameter: wp_register_script( // Handle ‘curtain-instance’, // Path get_stylesheet_directory_uri().’/curtain-instance.min.js’, // Dependencies array(‘curtain’,’jquery’,’jquery-migrate’), // Version // In footer? true ); Try adding that parameter: wp_register_script( // Handle ‘curtain-instance’, // Path get_stylesheet_directory_uri().’/curtain-instance.min.js’, // Dependencies array(‘curtain’,’jquery’,’jquery-migrate’), // Version ‘1.0’, // In … Read more

JQuery not working in my plugin [closed]

You’re using an invalid action: add_action(‘wp_enqueue_script’, ‘run_js_script’); The correct action is wp_enqueue_scripts (plural), not wp_enqueue_script (singular). Use this instead: add_action(‘wp_enqueue_scripts’, ‘run_js_script’); Edit Same problem here: add_action(‘wp_register_script’, ‘register_script’); Just hook it into wp_enqueue_scripts for simplicity: add_action(‘wp_enqueue_scripts’, ‘register_script’); Actually, two better options: Put your wp_register_script() call in the same run_js_script callback as your wp_enqueue_script() call. Eliminate wp_register_script() … Read more

Enqueue Google CDN jQuery in Footer

The right hook The wp_default_scripts-hook only runs in the admin as it’s called by wp_default_scripts() on ~/wp-admin/load-scripts.php where it’s hooked at the end of the file. So to move jQuery in public to the footer, you have to use a different hook: wp_enqueue_scripts, which only runs in the public. No admin check needed. <?php defined( … Read more

Vimeo Froogaloop API, working in Fiddle but not WP

From: https://developer.vimeo.com/player/js-api#universal-event-spec If you’re embedding and controlling multiple players on a page or using our JS API library (Froogaloop), you should give each player a player_id that matches the id of the iframe element. http://player.vimeo.com/video/VIDEO_ID?api=1&player_id=vimeoplayer You may need to add the player_id query parameter to the src definition.

wpColorPicker: How update colors on input value update?

I was able to solve this by looking into the inner .iris() and check that it has a .(‘color’) method that allows to set a color at runtime. Thankfully, this .(‘color’) method is supported too by .wpColorPicker(), so one can do: var new_color = $the_related_field.val(); $the_colorpicker.wpColorpicker(‘color’, new_color); to overcome the annoyance of not having an … Read more

Hide menu item in certain condition

In your actual code the function to add the script is never executed. You can put the function add_my_script() wherever you want but you need to hook it into a WordPress event. The best event for this case is the wp_enqueue_scripts: add_action(‘wp_enqueue_scripts’, ‘add_my_script’); function add_my_script() { wp_enqueue_script( ‘hide-menu’, // name your script so that you … Read more

Create search form in menu as in Twenty Fourteen theme

.animate() is the jQuery function you’re going to want to have a look at. Very handy. Here’s a working example for your particular question: http://jsfiddle.net/B8Yv9/ And a complete html workup: <!doctype html> <html> <head> <meta charset=”utf-8″> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”></script> <style> .search { width:300px; } .input-group { position:relative; float:right; } #btn-search { cursor:pointer; position:absolute; padding:3px 8px; … Read more

Using shipped version of jquery

The jQuery library packed with WordPress, operates under noConflict mode. Means you can not use $ in your jQuery snippet/code. Either use jQuery instead of $. or use noConflict wrapper like this. <script type=”text/javascript”> <!– jQuery(document).ready(function($) { // your jquery function, you can use $ here. }); // –> </script>