wordpress引导滑块旋转木马

wordpress引导滑块旋转木马,wordpress,twitter-bootstrap,Wordpress,Twitter Bootstrap,我希望有人能在这方面帮助我,一直在网上寻找答案。 我在localhost中使用wordpress,但转盘似乎工作不正常 事实上,我必须回答一些问题,但重要的是第一个问题 如何使转盘调用成为特定类别,而不是在wordpress中显示所有帖子 您需要单击箭头,这样图像幻灯片才能工作,有没有办法将其设置为自动幻灯片 <?php $use_carousel = of_get_option('showhidden_slideroptions'); i

我希望有人能在这方面帮助我,一直在网上寻找答案。 我在localhost中使用wordpress,但转盘似乎工作不正常

事实上,我必须回答一些问题,但重要的是第一个问题

  • 如何使转盘调用成为特定类别,而不是在wordpress中显示所有帖子

  • 您需要单击箭头,这样图像幻灯片才能工作,有没有办法将其设置为自动幻灯片

    <?php
    
                $use_carousel = of_get_option('showhidden_slideroptions');
                if ($use_carousel) {
    
                ?>
    
                <div id="myCarousel" class="carousel slide">
    
                    <!-- Carousel items -->
                    <div class="carousel-inner">
    
                        <?php
                        global $post;
                        $tmp_post = $post;
                        $show_posts = of_get_option('slider_options');
                        $args = array( 'numberposts' => $show_posts ); // set this to how many posts you want in the carousel
                        $myposts = get_posts( $args );
                        $post_num = 0;
                        foreach( $myposts as $post ) :  setup_postdata($post);
                            $post_num++;
                            $post_thumbnail_id = get_post_thumbnail_id();
                            $featured_src = wp_get_attachment_image_src( $post_thumbnail_id, 'wpbs-featured-carousel' );
                        ?>
    
                        <div class="<?php if($post_num == 1){ echo 'active'; } ?> item">
                            <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'wpbs-featured-carousel' ); ?></a>
    
                            <div class="carousel-caption">
    
                                <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
                                <p>
                                    <?php
                                        $excerpt_length = 100; // length of excerpt to show (in characters)
                                        $the_excerpt = get_the_excerpt(); 
                                        if($the_excerpt != ""){
                                            $the_excerpt = substr( $the_excerpt, 0, $excerpt_length );
                                            echo $the_excerpt . '... ';
                                    ?>
                                    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" class="btn btn-primary">Read more &rsaquo;</a>
                                    <?php } ?>
                                </p>
    
                            </div>
                        </div>
    
                        <?php endforeach; ?>
                        <?php $post = $tmp_post; ?>
    
                    </div>
    
                    <!-- Carousel nav -->
                    <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
                    <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
                </div>
    
                <?php } // ends the if use carousel statement ?>
    
    
    

  • 非常感谢你的帮助!谢谢,试试这个

  • 我如何使转盘呼叫成为一个特定类别,而不是在我的wordpress中显示所有帖子
  • 在这里,您可以使用不在id中的类调用转盘初始化,如下所示:

    $(".class").carousel( { autoSlide: true } );
    
    $("div").carousel( { autoSlide: true } );
    
    2.您需要单击箭头,以便图像幻灯片工作,是否有方法将其设置为自动幻灯片? 我认为旋转木马为autoslide提供了一个参数,如下所示:

    $(".class").carousel( { autoSlide: true } );
    
    $("div").carousel( { autoSlide: true } );
    

    参考网站:

    嗨,非常感谢希拉格,我用这个:现在一切都好了