如何在旋转木马滑块中显示帖子特色图像

时间:2017-09-25 12:52:47

标签: php wordpress loops

我想在bootstrap轮播滑块中显示帖子特色图片,即四排...我正在尝试实现它...这是我的代码。

源代码是:

<div class="carousel-inner">
    <?php //$i=0;
        $args=array(
            'post_type' => 'clients',
            'post_status' => 'publish',
            'posts_per_page' => -1  ); 

        $custom = new WP_Query( $args );
        while( $custom->have_posts() ) { $custom->the_post();
        $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID,   'full') ); $logo=array($url);
        if ( $c == 0 ){ $class = 'active';}
        else{$class = '';}          ?>
    <div class="item  <?php  echo $class; ?>">
        <div class="row">
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                <a class="thumbnail" href="#"><img alt="" src="<?php echo $logo[0]; ?>"></a>
            </div>
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                <a class="thumbnail" href="#"><img alt="" src="<?php echo $logo[1]; ?>"></a>
            </div>
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                <a class="thumbnail" href="#"><img alt="" src="<?php echo $logo[2]; ?>"></a>
            </div>
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                <a class="thumbnail" href="#"><img alt="" src="<?php echo $logo[3]; ?>"></a>
            </div>          
        </div>
    </div>
    <?php $c++; ?>
    <?php } ?>
</div>

0 个答案:

没有答案