Dynamically add Js
I have a basic bunch of CSS/Js files defined in my functions.php file. There I register and enqueue those scripts and stylesheets.
But in specific situations I want to load additional scripts based on the site template which is used.
I tried to register and enqueue those additional scripts in the specific Template file, but it didnt work. It does only work when included in the functions.php.
What is the correct way to do this?