【发布时间】:2018-06-24 02:14:23
【问题描述】:
我添加了 Flexslider,站点 http://test06.menchasha.ru/。 标题中的代码:
<script type="text/javascript"> (function($) {
jQuery(window).load(function() {
jQuery('#featured-image-slider .flexslider').flexslider({
animation: 'slide',
slideshowSpeed: 9000,
animationSpeed: 900,
pauseOnAction: true,
pauseOnHover: true,
controlNav: false,
directionNav: true,
controlsContainer: "#featured-image-slider",
});
})
})(jQuery)</script>
首页代码:
<section id="featured-image-slider">
<div class="flexslider">
<ul class="slides">
<?php query_posts(array('post_type' => 'Sliders','orderby' => 'rand')); if(have_posts()) : while(have_posts()) : the_post();?>
<li class="slide">
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php the_post_thumbnail(); ?>
</li>
<?php endwhile; endif; wp_reset_query(); ?>
</ul>
</div>
</section>
正确包含脚本和样式。 但是滑块没有显示我的自定义帖子类型。 你能帮忙吗?
谢谢!
【问题讨论】:
-
post_type 是否区分大小写?
-
这就是我创建 post_type 的方式: function create_post_type() { register_post_type( 'acme_product', array( 'labels' => array( 'name' => __( 'Sliders' ), 'singular_name' => __( 'Slider' ) ), 'public' => true, 'has_archive' => true, 'supports' => array('thumbnail', 'title', 'excerpt') ) ); } add_action('init', 'create_post_type');
-
那么帖子类型应该是'post_type' => 'acme_product',对吧?
-
是的,它奏效了。谢谢!
-
没问题 - 我会将其作为答案发布,如果您能接受将不胜感激:)
标签: jquery wordpress jquery-plugins custom-post-type