Different Footer scripts

Hello,

I’m currently working on transforming an HTML/CSS website to Wordpress. I need to add few scripts to the footer but only on a certain page, I wasn’t really sure how to proceed, as currently anything I add to the footer won’t be taken in account since i’m using index.html as a Master Page.

Additionally, I’ve tried setting up that same page in a separate page (has its own Header/Footer), though, en queuing in functions.php seem to just enqueue it everywhere anyway.

Anyone has an idea?
Thanks

I believe I answered my own question, I am not sure if this is the best use, but I did something like this:

  • I added the script to my “main” section for it to not get replaced by my master page when I make changes there
  • Enqueued the script with a new handle and with dependencies (Jquery), deregistered and enqueued it
  • Finally added a condition if_page to only be shown on a certain slug page

1 Like