2

私はワードプレスに非常に慣れていないので、困惑しています。スライド ショーを作成しようとしていますが、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 &amp; 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ます。このエラーを修正してスライドショーを機能させるにはどうすればよいですか?

4

1 に答える 1

4

jQuery代わりに使用するjquery Q必要があります大文字、inisdeslideshow.js

于 2012-06-12T13:13:36.247 に答える