I want to run a different external JavaScript file for each WordPress page, depending on the page ID.
If Page ID is [1], run somescript.js
if Page ID is [15], run someotherscript.js
if Page ID is [195], run yetanotherscript.js
if default, run defaultscript.js
Could someone please show me how this is done in WordPress with Conditional Tags?
Best regards,
Dimitri Vorontzov
Having tried the suggested solutions, I couldn’t make them work. I’m sure Chris’s advice is perfectly solid and it’s me who’s doing something wrong, but so far I had to resort to a duct tape solution:
I created a custom page template for every version of the script I wanted to run, and assigned a separate template to each page. Not the most elegant solution, but it works.