JS Not running when it is pulled in by the shortcode

I am using a shortcode to pull in some JS that is needed within some raw content but this is not working. It is there but doesn’t seem to run. If I just put the in the raw, it breaks the page. What do I do?

Hello @The_Capture_Factory,

Thanks for writing in!

The JS code should be added in the designated area which is on the left side of the page.

Kindly let us know how it goes.

Hi there, it needs to reference a specific file in a plugin to import. Attached in the secure note below. This is where I am having the issue as it is not running and I am unable to use the Javascript area.

Hi @The_Capture_Factory,

Do you have the documentation on that options so that we can check and see how it works? In that way, we can easily determine and give you some piece of advice.

Thank you.

Link to the AOS Library that I am using below and a link to the AOS page which, at the bottom, tells you how to integrate.

https://michalsnik.github.io/aos/

Hi @The_Capture_Factory,

Although it is not the issue related to the theme, still it is not understandable why you are trying to get a JavaScript file from the plugin using the shortcode. The plugin should have the proper enqueue method to include the JavaScript file, and you don’t need to add it. If you have any external file, which you want to include, you can add the JavaScript file into your child theme folder and use the wp_enqueue_script method in the functions.php file. I would suggest you to go through the following article on how to include the JavScript files.

Hope it helps.
Thanks

Apologies, I’ve attached the wrong links there. It should be:

It works fine when I do not have any other sections in the page as can be seen in the link below in a secure note. Once I add other sections in, it stops working.

Hi @The_Capture_Factory,

There might be some other reason behind your issue, I would suggest you to enqueue the JavaScript file as described in my previous post. If you are not proficient on this, I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where the customization questions are answered.

Thanks

Thanks for the suggestion of using enqueue. I have done this and can see that it loading on the frontend in the console without any errors but it still isn’t running. It’s a little annoying that we can get it to work on another page without sections in so just wondering what happens when we add another section into the page that breaks the JS running?

Hello @The_Capture_Factory,

Instead of using custom JS coding, why don’t you the ready-made Particle JS plugin. Perhaps one of these plugins can help you:

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.