将 jquery 导入 wordpress [英] importing jquery into wordpress

查看:17
本文介绍了将 jquery 导入 wordpress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你不使用<?php wp_head()时,你能将jquery导入wordpress吗??>

我刚开始使用 wordpress,并没有将它包含在我的主题中,当我现在添加它时,它会搞砸一些事情,因为我只需要使用 jquery 添加另外 1 个东西,我不想做修复这些的麻烦事情,所以我只需要添加没有标签的jquery.有什么想法吗?

i'm just beginning with wordpress and didnt include that in my theme, when i add it now it meses some things up and since i only have to add 1 more thing with jquery i dont want to do the hassle of fixing those things, so i just need to add jquery without the the tag. Any ideas?

推荐答案

您可以像这样在 header.php 中手动添加来自 Google CDN 的 jQuery,高于对 jQuery 库的其他调用:

You can manually add jQuery from the Google CDN like this in header.php, above an other calls to jQuery libraries:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

但要意识到,在您的主题中不使用 wp_head 意味着您需要为大多数插件手动添加指向 JS 和 CSS 文件的链接,因为它们通过 wp_head 有时也通过 get_footer 连接到 WP.

But realize that not using wp_head in your theme means you will need to manually add links to JS and CSS files for most plugins, as they hook into WP via wp_head and sometimes get_footer, too.

如果出现问题,请在 Firefox 中使用 Firebug 来确定正在加载什么 JS 以及是否有冲突和错误.

If things don't work right, use Firebug with Firefox to determine what JS is loading and if there are conflicts and errors.

这篇关于将 jquery 导入 wordpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆