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?
2
Answers
add this to your functions.php in child theme:
with the query
if( is_page( 'pageid here' ) )
you can insert your desired pageid where the script shold loaded.You can try like this