Jquery循环插件与wordpress,Jquery未定义?
我对wordpress很陌生,我很困惑。我正在尝试创建一个幻灯片放映,并且已经按照我能找到的所有方向将jquery添加到wordpress。 在我的function.php文件中,我添加了:Jquery循环插件与wordpress,Jquery未定义?,jquery,wordpress,Jquery,Wordpress,我对wordpress很陌生,我很困惑。我正在尝试创建一个幻灯片放映,并且已经按照我能找到的所有方向将jquery添加到wordpress。 在我的function.php文件中,我添加了: function my_scripts_method() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/
function my_scripts_method() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
wp_enqueue_script( 'jquery' );
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
在my header.php中,我有:
在我的模板中,我有:
当我尝试运行slideshow时,我在slideshow.js文件中收到一个jquery未定义错误。
如何修复此错误并使我的幻灯片正常工作?使用jQuery代替jQuery Q必须是大写的,inisde slideshow.js使用jQuery代替jQuery Q必须是大写的,inisde slideshow.js我添加了“后点,我仍然得到了错误,你看到了导致错误的其他原因吗?只是一个复制粘贴错误,现在修好了。但我仍然收到jquery未定义错误:我做了您建议的更改,并收到了第二条错误消息,因此我不得不将其放回数组“jquery”,我回到了jquery只是没有定义的错误。下面是有问题的页面:@Jim我很高兴我能帮助您我添加了“后点,我仍然得到错误,你有没有看到其他可能导致它的东西?只是一个复制粘贴错误,现已修复。但我仍然收到jquery未定义错误:我做了您建议的更改,并收到了第二条错误消息,因此我不得不将其放回数组“jquery”,现在我返回到jquery没有定义的错误。下面是有问题的页面:@Jim我很高兴我能帮助您
<?php
wp_enqueue_script('jquery.cycle.js', get_bloginfo("stylesheet_directory").'/js/jquery.cycle.js', array('jquery'));
wp_enqueue_script('slideshow', get_bloginfo("stylesheet_directory") . '/js/slideshow.js');
wp_head();
?>
jquery(document).ready(function($){
jquery('#gallery').cycle('fade');
});
<div id="gallery">
<p>
<a href="http://bdf.serverplanet.com/wp-content/uploads/2012/06/BD_Laurene1339467077747.jpg">
<img src="http://bdf.serverplanet.com/wp-content/uploads/2012/06/BD_Lauren_s.jpg" alt="Caption" />
</a>
<em>Brad & Lauren</em>
</p>
<p>
<a href="http://bdf.serverplanet.com/wp-content/uploads/2012/06/BD_bike.jpg" target="_blank">
<img src="http://bdf.serverplanet.com/wp-content/uploads/2012/06/BD_bike_s.jpg" alt="Caption" />
</a>
<em>Biking on the Vineyard</em>
</p>
<a href="http://bdf.serverplanet.com/wp-content/uploads/2012/06/bedcad.jpg" target="_blank"><img src="http://bdf.serverplanet.com/wp-content/uploads/2012/06/bedcad_s.jpg" alt="Caption" /></a>
<em>Brad and Cass</em>
<a href="http://bdf.serverplanet.com/wp-content/uploads/2012/06/brad11.jpg" target="_blank">
<img src="http://bdf.serverplanet.com/wp-content/uploads/2012/06/brad11_s.jpg" alt="Caption" />
</a>
<em>At the S.A.S.S. show</em>
<a href="http://bdf.serverplanet.com/wp-content/uploads/2012/06/Brad_and_Alexis.jpg" target="_blank">
<img src="http://bdf.serverplanet.com/wp-content/uploads/2012/06/Brad_and_Alexis_s.jpg" alt="Caption" />
</a>
<em>With Alexis at a S.A.S.S. show</em>
</div>