为什么不';在Wordpress中使用jQuery和cycle?
我真的在为这个问题绞尽脑汁 我想在我的wordpress index.php中通过cycle播放我的特色文章的幻灯片,但是。。wordpress不会 首先,我将循环和我的脚本放入队列的标题中:为什么不';在Wordpress中使用jQuery和cycle?,jquery,wordpress,post,cycle,categories,Jquery,Wordpress,Post,Cycle,Categories,我真的在为这个问题绞尽脑汁 我想在我的wordpress index.php中通过cycle播放我的特色文章的幻灯片,但是。。wordpress不会 首先,我将循环和我的脚本放入队列的标题中: <?php wp_enqueue_script('jquery.cycle.all.min', '/wp-content/themes/black1/js/jquery.cycle.all.min.js', array('jquery')); wp_enqueue_script('jqu
<?php
wp_enqueue_script('jquery.cycle.all.min', '/wp-content/themes/black1/js/jquery.cycle.all.min.js', array('jquery'));
wp_enqueue_script('jquery_script', '/wp-content/themes/black1/js/jquery_script.js');
?>
然后,我将此代码放在模板的index.php中,以显示特色类别中最近的5篇文章:
<div id="slideshow">
<?php query_posts('cat=88&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="slideshow_post">
<div class="slideshow_overlay">
<h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<p class="byline"><?php echo get_post_meta($post->ID, 'beschreibung', true); ?></p>
</div>
<a class="slideshow_pic" href="<?php the_permalink() ?>"><img src="images/testbild.jpg" alt="test"/></a>
</div>
<?php endwhile;?>
真正让我兴奋的是,这个带有css的动画和其他东西都在一个新的html页面中工作
我做错了什么
来自德国的问候
KAiN您是否尝试切换排队呼叫?通常,在包含任何jQuery插件之前,您应该先包含jQuery。切换它,但这没有什么区别……您能给我们展示服务器HTML响应而不是PHP代码吗?如果您这样做,更多的人将能够帮助您。您可以不使用排队而是将代码放在页脚中,然后当页面最终加载时,将开始执行jquery操作。。。你能给我们看一些网址或截图来帮助我们解决这个问题吗?耶!成功了!谢谢大家!
<div id="slideshow">
<?php query_posts('cat=88&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="slideshow_post">
<div class="slideshow_overlay">
<h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<p class="byline"><?php echo get_post_meta($post->ID, 'beschreibung', true); ?></p>
</div>
<a class="slideshow_pic" href="<?php the_permalink() ?>"><img src="images/testbild.jpg" alt="test"/></a>
</div>
<?php endwhile;?>
#slideshow {
width: 700px;
height: 400px;
background: #ccc;
margin: 0 0 20px 0;
border: 1px solid #ddd;
}
.slideshow_post{
width: 640px;
height: 360px;
background: #777;
padding: 2px;
position: relative;
}
.slideshow_overlay {
width: 640px;
height: 100px;
position: absolute;
background: url(images/overflow.png) repeat;
clear: none;
bottom: 0;
}
a.slideshow_pic{
width: 640px;
height: 360px;
overflow: hidden;
padding: 0;
}