私はワードプレスに非常に慣れていないので、困惑しています。スライド ショーを作成しようとしていますが、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/jquery.min.js');
wp_enqueue_script( 'jquery' );
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
私header.php
は持っています:
<?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();
?>
私slideshow.js
は:
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>
スライドショーを実行しようとすると、ファイルに「jquery が定義されていません」というエラーが表示されslideshow.js
ます。このエラーを修正してスライドショーを機能させるにはどうすればよいですか?