Unable to dequeue a plugin script. I think I’ve tried everything

Another option is to use the script_loader_tag filter to catch and remove the actual HTML tag before it is output, eg.: add_filter( ‘script_loader_tag’, ‘remove_social_login_frontend’, 10, 3 ); function remove_social_login_frontend( $tag, $handle, $src ) { if ( ‘wc-social-login-frontend’ === $handle ) {$tag = ”;} return $tag; } Note you could also do this via a string … Read more

Is It Possible to add JS AFTER the Enqueue within the same Function?

The wp_add_inline_script() is designed for this purpose. It lets you add some inline JavaScript above or below an enqueued script. You just need to pass the contents of the script, without <script> tags: function custom_thing () { if ( is_page( 2138 ) ) { wp_enqueue_script( ‘external-script’, ‘http://domain.com/external/script.js’, array( ‘jquery’ ), 0, true ); wp_add_inline_script( ‘external-script’, … Read more

Is there a way to list all the JavaScript scripts that are actually loaded by WordPress? Do we care?

I’ll answer each of your questions in order: Do we care which scripts are enqueued? Not really. WordPress registers each script and maintains it in an array. When you enqueue the script, WordPress will load it and any dependencies it has when it calls wp_print_scripts() (which is tied to the wp_head hook). If you enqueue … Read more

Enqueue never runs

Be sure about the parameters wp_enqueue_style and wp_enqueue_script uses.(The parameters are not same for both ) wp_enqueue_style( $handle, $src, $deps, $ver, $media ); you are giving false,false,true for dependency,version and media which is a blunder mistake.If you are not sure about them, you can avoid them and if you want to following is an example … Read more

plugins_url() incorrectly returning wp-include directory

Masonry is already registered by WordPress. From wp-includes/script-loader.php: // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv. // It sets jQuery as a dependency, as the theme may have been implicitly loading it this way. $scripts->add( ‘masonry’, “/wp-includes/js/masonry.min.js”, array(), ‘3.1.2’, 1 ); $scripts->add( ‘jquery-masonry’, “/wp-includes/js/jquery/jquery.masonry$dev_suffix.js”, array( ‘jquery’, ‘masonry’ … Read more

How to create a child theme with multiple css files.

Your question is general, so I cannot answer it in details. If the parent theme enqueues some styles using get_stylesheet_directory_uri() in the path they won’t be available in child theme. Then you should enqueue lacking stylesheets in your child’s function.php using get_template_directory_uri() which will point to the parent theme directory. Some example: add_action( ‘wp_enqueue_scripts’, ‘wpse179217_enqueue_styles’ … Read more

How to set cookies to switch style sheets when a link is clicked and set it till another particular link is clicked?

You can use init action to set cookie, and other init action to read it. However due its a cookie… you will need also to check GET variable. add_action(‘init’, ‘is_it_mobile_or_desktop’, 1); function is_it_mobile_or_desktop(){ if (isset($_GET[‘site’]) && in_array($_GET[‘site’], array(‘mobile’, ‘desktop’)) ) { setcookie( ‘site’, $_GET[‘site’], time() – YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); } } add_action(‘init’, ‘who_am_i’, 2); … Read more

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