What I need done:
The mobile menu on the site (let me know if you want to see the dev site, so I don't get marked as spam for posting the link) is loaded by a script that hides the main menu when the browser width falls below 1030px. Before then the mobile menu div doesn't exist. I have a shopping cart link on the desktop site that I'm trying to insert into that mobile menu div automatically whenever that div is generated by the script. Then I'll hide the one in the desktop code, etc.
I'm using the following to enqueue some jQuery, which in turn loads the custom "cart link" PHP plugin into a mobile menu div that is loaded by a separate js file only when the browser width is less than 1030px. Still with me? Here's the code:
This isn't working.
I had first tried including the script right in the header, but the script required the mobile menu script to load before it. So I put the script in that file right after the script that calls the mobile menu, taking care of that dependancy. Then I discovered that this needed me to
require_once = wp-load.php in the php plugin, which isn't ideal.
After searching around, I came across the
wp_enqueue_scripts method above. It doesn't need the plugin to
require_once = wp-load.php(I don't think), and it eliminates putting the code in
head and overbearing the server, but it's still not working.