私は考えることができるすべてを試しました。これは難しいことではありません。 WordPress(特にjQuery Cycle Plugin)でjQueryを使用するプロセスを私に説明してください。私はheader.phpの中WordPressでjQuery Cycle Pluginを使用するには?
:
<?php
wp_enqueue_script('jquery.cycle.all.min', '/wp-content/themes/andrewhavens/jquery.cycle.all.min.js', array('jquery'));
wp_enqueue_script('featured-work-slideshow', '/wp-content/themes/andrewhavens/featured-work-slideshow.js');
wp_head();
?>
私は私のテーマのディレクトリにこれら二つのjsファイルをアップロードしました。私が持っている機能を備えた作業-slideshow.jsで
:
jQuery(document).ready(function($) {
$('#featured-works').cycle('fade');
});
そして、私のテンプレートでは、私が持っている:
<div id="featured-works">
<?php query_posts('category_name=featured-work&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="featured-work">
<div class="featured-work-image-container" style="float:left; width:600px;">
<?php $image = get_post_meta($post->ID, 'homepage-image', true); ?>
<img src="<?php echo $image; ?>" width="500" height="300" style="margin-left:30px;">
</div>
<p style="float:left; width:300px;">
<?php the_title(); ?><br />
<a href="<?php the_permalink() ?>">Read More!</a>
</p>
</div>
<?php endwhile;?>
</div>
は私が間違って何をやっています?
ニース!その機能が存在するかどうかは分かりませんでした。しかし、なぜ彼らがjavascriptファイルであるときに "スタイルシートディレクトリ"を指定していますか? 「javascriptsディレクトリ」機能はありますか? – Andrew
@Andrew指定された 'js'ディレクトリはありませんが、[get_template_directory_uri()](http://codex.wordpress.org/Function_Reference/get_template_directory_uri)または[get_stylesheet_directory_uri](http://codex.wordpress .org/Function_Reference/get_stylesheet_directory_uri)。 –