Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在动态内容的carsouel滑块中仅激活一个项目_Php_Wordpress_Carousel - Fatal编程技术网

Php 在动态内容的carsouel滑块中仅激活一个项目

Php 在动态内容的carsouel滑块中仅激活一个项目,php,wordpress,carousel,Php,Wordpress,Carousel,你可以做这样的事情,当然这是在拉威尔,但我相信你会明白的 <section class="product_section"> <div class="container"> <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false"> <!-- Wrapper for slides --> <di

你可以做这样的事情,当然这是在拉威尔,但我相信你会明白的

<section class="product_section">
<div class="container">
    <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
     <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
            <?php $loop = new WP_Query( array( 'post_type' => 'product_theme', 'posts_per_page' => -1 ) ); ?>
            <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
            <div class="item <?php if($c==1) { ?> active<?php } ?>">
                <div class="row">
                    <div class="col-xs-12 col-sm-7 col-md-7 product_image">
                        <?php twentysixteen_post_thumbnail(); ?>
                    </div>
                    <div class="product_detail col-xs-12 col-sm-5 col-md-5">
                        <h2><?php the_title(); ?></h2>
                            <?php echo get_post_meta(get_the_ID(), 'my_custom_fields_custom-field-3', TRUE);?>/span>
                                <?php the_content(); ?>
                                <a href="<?php echo get_post_meta(get_the_ID(), 'my_custom_fields_custom-field-1', TRUE);?>" target="_blank" class="live_demo">Live Demo</a>
                                <a href="<?php echo get_post_meta(get_the_ID(), 'my_custom_fields_custom-field-2', TRUE);?>" class="buy_know">View Details</a>
                    </div><!-- product_detail col-xs-12-->
                </div><!--ROW -->
            </div><!-- itEM-->
            <?php  endwhile; $c=$c+1; wp_reset_query(); ?>
        </div><!--carousel-inner -->

        <!-- Left and right controls -->
        <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div><!--myCarousel -->
</div><!--container -->
</section>

@如果(计数($images)>0)
@foreach($images作为$image)

你可以做这样的事情,当然这是在拉威尔,但我相信你会明白的

<section class="product_section">
<div class="container">
    <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
     <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
            <?php $loop = new WP_Query( array( 'post_type' => 'product_theme', 'posts_per_page' => -1 ) ); ?>
            <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
            <div class="item <?php if($c==1) { ?> active<?php } ?>">
                <div class="row">
                    <div class="col-xs-12 col-sm-7 col-md-7 product_image">
                        <?php twentysixteen_post_thumbnail(); ?>
                    </div>
                    <div class="product_detail col-xs-12 col-sm-5 col-md-5">
                        <h2><?php the_title(); ?></h2>
                            <?php echo get_post_meta(get_the_ID(), 'my_custom_fields_custom-field-3', TRUE);?>/span>
                                <?php the_content(); ?>
                                <a href="<?php echo get_post_meta(get_the_ID(), 'my_custom_fields_custom-field-1', TRUE);?>" target="_blank" class="live_demo">Live Demo</a>
                                <a href="<?php echo get_post_meta(get_the_ID(), 'my_custom_fields_custom-field-2', TRUE);?>" class="buy_know">View Details</a>
                    </div><!-- product_detail col-xs-12-->
                </div><!--ROW -->
            </div><!-- itEM-->
            <?php  endwhile; $c=$c+1; wp_reset_query(); ?>
        </div><!--carousel-inner -->

        <!-- Left and right controls -->
        <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div><!--myCarousel -->
</div><!--container -->
</section>

@如果(计数($images)>0)
@foreach($images作为$image)

您在哪里定义
$c
变量?另外,你能给我们上面部分的HTML输出吗?网页上的旋转木马在客户端由Javascript或高级CSS管理,除非你每次都进行某种页面刷新。您应该在word press中查找构建旋转木马的教程。或者,如果您正在使用一些旋转木马javascript文件,则需要发布该旋转木马的相关信息。您在哪里定义
$c
变量?另外,你能给我们上面部分的HTML输出吗?网页上的旋转木马在客户端由Javascript或高级CSS管理,除非你每次都进行某种页面刷新。您应该在word press中查找构建旋转木马的教程。或者,如果您正在使用一些旋转木马javascript文件,则需要发布该旋转木马的相关信息。