I have a few posts needing javascript, but I can't rely on plugins. I know it can be achieved through functions.php
, but there's another problem: I don't want the code to be loaded on every page. I need each code to load on its specific post only. I've been searching for around 1 hour for a solution, but everything that I find is either suggesting a plugin or throw everything inside a function file and then the javascript code will load in every page. What I'm looking for is something like this:
If post is using [shortcode], then load js file postscript.js