I am writing an interactive google map in javascript for a wordpress page. As far as I know, the only way to use javascript with wordpress is by creating a separate .js file and just calling the methods from there within the wordpress page. So my question is, if I need to use the google maps api in my javascript code, how do I 'include' it within the .js file instead of using a <script>
tag in the html?
Asked
Active
Viewed 84 times
0

Sinan Ünür
- 116,958
- 15
- 196
- 339

azrosen92
- 8,357
- 4
- 26
- 45
1 Answers
1
AFAIK there is no include
in javascript. Take a look at wp_enqueue_script().
Edit
Just stumbled over the yepnope.js library by Alex Sexton. Maybe this is what you are looking for.

CSSian
- 1,621
- 13
- 19

Gerald Schneider
- 17,416
- 9
- 60
- 78
-
this may be helpful as well: http://stackoverflow.com/questions/950087/include-javascript-file-inside-javascript-file – Gerald Schneider Feb 05 '13 at 13:36
-
can I use `wp_enqueue_script()` within the html in the online interface for editing a wordpress page? – azrosen92 Feb 05 '13 at 19:40
-
As long as you can edit PHP code there I don't see why not. I never used the online interface. – Gerald Schneider Feb 05 '13 at 20:28