WP script versioning breaks cross-site caching?

Use null as $ver param: wp_deregister_script( ‘jquery’ ); wp_register_script( ‘jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js’, false, null); wp_enqueue_script(‘jquery’); Output: <script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>

Load multiple Javascript scripts

I formatted that code as best I could, and once formatted it is obviously very broken. wp_enqueue_script takes 5 parameters. You have 9. And several of the first five are wrong. I expect that you would see errors if you had debugging enabled. You seem to be trying to enqueue all of your scripts in … Read more

Add `datetimepicker` to form

You can try this. add_action( ‘wp_enqueue_scripts’, ‘wpcustom_enqueue_script’ ); function wpcustom_enqueue_script() { wp_enqueue_style( ‘datepicker-style’, ‘https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css’ ); wp_enqueue_script( ‘js-datepicker’, ‘https://code.jquery.com/ui/1.12.1/jquery-ui.js’, array(‘jquery’), null, true); } Readmore: http://jqueryui.com/datepicker/

Get the list of enqueued/registered scripts for a specific post?

I’m not familiar with Gutenberg, but as you mentioned it as an example, I assume you didn’t mean “only” Gutenberg. The wp_enqeue_script() or wp_enqueue_style() functions do not accept arguments regarding posts or pages. The script are registered and rendered globally. If a script is output on certain posts only, then it has to be a … Read more

Which method is best to enqueue scripts

Always use the built-in versions. Don’t waste time with old WordPress installations – other plugins will break there too. See wp-includes/script-loader.php for the list of available files. Quite a lot. 🙂 And avoid remote resources. Some (Google) fail to send the scripts gzip compressed to all supporting browsers, others may not be reliable enough. There … Read more

How do I conditionally enqueue script for CPT single post type with plugin?

Make sure your code runs in wp_enqueue_scripts action hook. Also checkout your script handle ‘owl.carousel.js’. In wp_script_is(), it is not the same than in the 2 later functions in which you enter it as ‘owl.carousel.min.js’. add_action( ‘wp_enqueue_scripts’, ‘enqueue_properties_scripts’ ); function enqueue_properties_scripts() { if ( ‘properties’ === get_post_type() ) { if ( wp_script_is( ‘owl.carousel.min.js’, ‘enqueued’ ) … Read more

jquery script not enqueued in child theme

There are two parts in the question I want to address: It didn’t work because the action uses a plural form: wp_enqueue_scripts, not wp_enqueue_script. I guess this happened, because the function you have to use here – wp_enqueue_script() – does use a singular. You should not use the function wp_enqueue_script() with so many parameters. Register … Read more

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