wp_enqueue_script adds only the first script

You gave each each script the same handle/id of ‘grid’ Try something like this. function banana_scripts() { wp_enqueue_script(‘grid’, get_stylesheet_directory_uri() . ‘/js/jquery.min.js’, null, null); wp_enqueue_script(‘grid2’, get_stylesheet_directory_uri() . ‘/js/main.js’, null, null); } add_action(‘wp_enqueue_scripts’, ‘banana_scripts’);

Javascript not working?

The “Failed to load resource” is probably a red herring and isn’t related to your issue. The fact that it is throwing an error about the $ shortcut means your js file is being loaded correctly. The likely issue is that jQuery in WordPress loads in “noConflict” mode. As such the $ shortcut will not … Read more

wp_enqueue_script with dependencies doesn’t work

This is a bug in WordPress. https://core.trac.wordpress.org/ticket/35873 As far as I can see, it can currently be fixed with https://core.trac.wordpress.org/attachment/ticket/35873/35873.3.patch, if you are reading this some time later, it has probably already been fixed for your WordPress version. As a temporary workaround, set parent dependencies to both child and grandchild. This way grandchild.js will not … Read more

wp_enqueue_scripts not working inside shortcode

$shortcode = new Shortcode_Class(); class Shortcode_Class { /** * If you should add the script or not * * @var bool */ private $addScript = false; public function __construct() { add_shortcode(‘test_shortcode’, array($this, ‘shortcode_content’)); // wp_enqueue_scripts // If you use the below the CSS and JS file will be added on everypage // add_action( ‘wp_enqueue_scripts’, array($this, … Read more

Simple jQuery Click Not Working, though console log recognizes the function [closed]

When enqueuing a script, you should state your script’s dependencies. In your case, it’s jQuery. Enqueue your script in the following way: wp_enqueue_script ( ‘my-plugin’, ‘path/to/the.js’, array( ‘jquery’ ) ); You may also want to ensure that your script IS loaded in the footer, by setting the last argument to true: wp_enqueue_script ( ‘my-plugin’, ‘path/to/the.js’, … Read more

How to avoid redefining requirejs in plugin when another plugin also uses requirejs

You could take a look at the enqueued scripts in $wp_scripts ($wp_scripts->registered), but the naming could be different (“it’s requirejs but let’s call it loadstuffjs, just because”), so I doubt it’ll be close to perfect. Also, your plugin might be loaded before the other plugin, and they might trigger the problem without you having any … Read more

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