Deregister multiple scripts using a function?

First, you’re attempting to deregister too late. You need to use wp_enqueue_scripts, rather than wp_print_scripts. Second, all you need to do is add a call to wp_deregister_script() for each script you need to deregister: <?php add_action( ‘wp_enqueue_scripts’, ‘my_deregister_javascript’, 100 ); function my_deregister_javascript() { if ( !is_page(array(‘order’, ‘shopping-cart’, ‘checkout’) ) ) { wp_deregister_script( ‘tcp_scripts’ ); // … Read more

Enqueue script inside IE conditional comments

Change <!–[if (gte IE 6)&(lte IE 8)]> <?php function blarg(){ wp_enqueue_script(‘selectivizr’, get_template_directory_uri() . ‘assets/js/vendor/selectivizr.js’); } add_action(‘wp_enqueue_scripts’, ‘blarg’, 101); ?> <![endif]–> to <!–[if (gte IE 6)&(lte IE 8)]> <script src=”<?php echo get_template_directory_uri(); ?>/assets/js/vendor/selectivizr.js” type=”text/javascript”></script> <![endif]–> wp_enqueue_script() should only be used in a functions.php file.

Conditionally load script depending on current admin page

You can do something like this add_action( ‘admin_menu’, ‘my_admin_menus’ ); function my_admin_menus() { $GLOBALS[‘my_page’] = add_menu_page( ‘Page Title’, ‘Menu Title’, MY_ADMIN_CAPABILITY, ‘menu-slug’, ‘show_page_content’); } add_action( ‘admin_enqueue_scripts’, ‘enqueue_admin_js’); function enqueue_admin_js($hook) { if($GLOBALS[‘my_page’] === $hook) { wp_enqueue_script( ‘jquery-ui-core’ ); wp_enqueue_script( ‘jquery-ui-tabs’ ); // Isn’t it nice to use dependencies and the already registered core js files? wp_enqueue_script( … Read more

JavaScript enque stopped working

I am not sure if you posted code as-is or extracted part of it, but per this snippet – you are hooking function inside itself. Which doesn’t seem like it will work nicely. 🙂 Also init hook should not be used for enqueue, on front-end hook to use is wp_enqueue_scripts, see where is the right … Read more

How do I get jQuery to Load before Bootstrap?

In place of your emnpty array() you are able to declare dependencies. For Script A to load before Script B, declare that A is dependent on B. Codex reference: http://codex.wordpress.org/Function_Reference/wp_enqueue_script It’s possible you have declared these dependencies within your register statements but these are not given above.

Custom script file enqueue has “?ver=4.5.1” when loading and doesn’t update

I agree with @Mark Kaplun – what you’re describing is an odd behavior though. Try this markup to override the $ver param. wp_enqueue_script( ‘script’, get_template_directory_uri() . ‘/js/script.js’, array ( ‘jquery’ ), null, true); https://developer.wordpress.org/themes/basics/including-css-javascript/ Alternatively, to work around the version cache try this markup which will generate a unique version with each page load. wp_enqueue_script( … Read more

Overwrite wp_enqueue_script under certain condition

The first wp_enqueue_script() in your code should be wp_register_script(). The enqueue function does the job while the register function is getting ready to do the job. It is always better to rather create a new js file to keep things organised. As to calling them, you can do the following wp_register_script( ‘abc’, ‘path_to’ ); wp_register_script( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)