Enqueue script only for IE

WordPress has a $is_IE global variable: global $is_IE; if($is_IE) enqueue_script(…); Personally I prefer the IE conditional comments. Other browsers ignore them anyway, so there’s no reason to use PHP for browser detection. You might also want to consider using 8 bit alpha PNG images instead of 24 bit PNGs, which don’t need any javascript fix … Read more

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

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

Hyphens vs. periods in the script slug in wp_register_script?

Use hyphens only. Take a look at wp-includes/script-loader.php: $scripts->add( ‘scriptaculous-sound’, ‘/wp-in $scripts->add( ‘scriptaculous-controls’, ‘/wp $scripts->add( ‘scriptaculous’, ”, array(‘sc // not used in core, replaced by Jcrop.js $scripts->add( ‘cropper’, ‘/wp-includes/js/cr $scripts->add( ‘jquery’, ‘/wp-includes/js/jqu // full jQuery UI $scripts->add( ‘jquery-ui-core’, ‘/wp-include $scripts->add( ‘jquery-effects-core’, ‘/wp-in $scripts->add( ‘jquery-effects-blind’, ‘/wp-i $scripts->add( ‘jquery-effects-bounce’, ‘/wp- $scripts->add( ‘jquery-effects-clip’, ‘/wp-in $scripts->add( ‘jquery-effects-drop’, ‘/wp-in $scripts->add( … Read more

wp_enqueue script my_javascript_file in the footer

You have true set in the 4th parameter (version), not the 5th. wp_enqueue_script( ‘my_javascript_file’, //slug get_template_directory_uri() . ‘/javascripts/app.js’, //path array(‘jquery’), //dependencies false, //version true //footer ); Also, as someone else mentioned, drop jquery enqueue, you’ve got it as a dependency, you don’t need to enqueue it as well. One last thing, your function name has … Read more

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