Register google jquery gets overwritten by plugin

First: do not de-register core-bundled scripts in order to register some arbitrary version of those scripts. WordPress currently (at time of writing) comes bundled with jQuery 1.7.1. When WordPress 3.4 comes out next month, that version will be (IIRC) 1.8.x. Core, Themes, and other Plugins will all rightfully expect the core-bundled version of jQuery to … Read more

include jquery plugin file not working

Your uses of wp_register_script and add_action are incorrect. Try the following code: function you_fancy_js(){ wp_register_script( ‘custom-script’, plugins_url( ‘/js/jquery.js’, __FILE__ ), array( ‘jquery’, ‘jquery-ui-core’, ‘jquery-validate’ ) ); wp_enqueue_script( ‘custom-script’ ); } add_action(‘wp_enqueue_scripts’,’you_fancy_js’); This assumes that your custom jQuery functions are in jquery.js and jquery, jquery-ui-core, and jquery-validate are already enqueued. You do not need admin_head. The … Read more

How to add GET variable after script url?

Filter script_loader_src and use add_query_arg(). You can use parse_url() or the second argument $handle to target specific scripts… I have included multiple redundant options here: add_filter( ‘script_loader_src’, ‘wpse_99842_add_get_var_to_url’, 10, 2 ); function wpse_99842_add_get_var_to_url( $url, $handle ) { if ( ‘my_handle’ !== $handle ) return $url; if ( empty ( $_GET[‘myvar’] ) ) return $url; $parts … Read more

How to register and enqueue JavaScript files without breaking plugin dependencies?

I would use jquery-masonry included in WordPress core: function my_scripts() { wp_enqueue_script( ‘jquery-masonry’, true ); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts’ ); If you really need the standalone masonry library, you should use your “first way” but I would not use “my_masonry” as handle for the script, I would use “masonry” if you have not modified the … Read more

How to make a customized user registration form using the built in wp-register() template tag

The Codex has an article that outlines how to do this: https://codex.wordpress.org/Customizing_the_Registration_Form It even provides an example: //1. Add a new form element… add_action( ‘register_form’, ‘myplugin_register_form’ ); function myplugin_register_form() { $first_name = ( ! empty( $_POST[‘first_name’] ) ) ? trim( $_POST[‘first_name’] ) : ”; ?> <p> <label for=”first_name”><?php _e( ‘First Name’, ‘mydomain’ ) ?><br /> … Read more