javascript - 如何让我的脚本在 WordPress 中运行

标签 javascript wordpress google-api

我有一个相当复杂的脚本,它使用 Google Geolocation API 和 Timezone API,我想将其集成到我的 WordPress 页面中。该脚本包括显示 Google map 。

从哪里开始?我尝试将代码粘贴到 WordPress 页面代码编辑器中,但这不起作用。

最佳答案

在页面的 head 部分包含 JS 库和 JS 函数。例如,您可以通过将代码添加到 WP 模板的 header.php 文件中来完成此操作。

this page 上的示例 4应该有帮助。

关于javascript - 如何让我的脚本在 WordPress 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26913498/

相关文章:

javascript - 选择选项更改时加载图像

javascript - 使用 JavaScript 连接到 Oracle DB

wordpress - session 已过期,请重新登录

php - 订单状态完成时更改购买特定产品的用户角色

java - 导入 com.google.api.services.samples.youtube.cmdline.Auth;

javascript - 如何使用 DoodleNerd 的 CSS 文本框提取文本?

javascript - 下划线 : map through object (even if undefined)

javascript - wordpress 和 wp_query 中的 ajax

javascript - 使用 Google Drive API 和 Node.js 创建 Google 文档

python - 如何返回GoogleAPI搜索结果的距离?