Site logo

Archived topic

What's the best way to add javascript?

1 reply · Started by Robert on November 29, 2021

Viewing posts 1–2 of 2

I see you recommend the Simple CSS plugin for adding CSS. This has a nice section on each page where I can add CSS directly from the editor for any particular page. Is there a way to do this with javascript too?

Also, I am a little confused about the best way to add css to a specific page. Should we use a hook element or simple css? Which is the best way?

Hi Robert,

You can use a hook element to add JS:

1.Choose wp_footer as hook name.
2.Choose where you want it to load in the location section, eg, pages > page A
3.Wrap your JS code like this <script> your code </script>, enter it in to the content area.

For CSS, simple CSS is easier to use and manage.

This archived topic is closed to new replies.