Javascript in WordPress
-
Greetings,
I have a collection of Javascript samples I have created over the years. I am trying to put these on my site. They are all in folders with the library files, images, etc. Self-contained. I have read the codex and several forum posts. I was wondering what is the best way to get these to run in wordpress posts. Per the codex:To include Javascript inside a post, you need to combine the call to the script file with the call to the JavaScript itself.
<script type=”text/javascript” src=”/scripts/updatepage.js”></script>
<script type=”text/javascript”>
<!–
updatepage();
//–></script>This makes good sense. My issue is the “scripts” folder, where should it be placed on the server (inside or outside of the wordpress install) and then, what would the path be specifically? Oh, and is it ok to put .js libraries here?
Finally, in the text editor of wordpress (visual editor disabled). Normally I would call on libraries and often put the script itself in the <head></head> section of an html page. Is that still the case here? Finally, are <body> and <canvas> tags valid? I’m pretty sure <canvas> tags are ok but I am concerned that <body> tags may not be.
So sorry if any of this is noobish, And thanks in advance!
- The topic ‘Javascript in WordPress’ is closed to new replies.