0
我想使用wordpress將圖像添加到我的引導程序傳送帶,我嘗試了一個foreach循環,然後嘗試輸出數組的每個部分我想進入正確的部分旋轉木馬,但它似乎並沒有工作。使用wordpress輸出圖像和標題到bootstrap傳送帶
這裏是我使用
<?php
$args = array(
'post_type' => 'attachment',
'orderby' => 'menu_order',
'order' => ASC,
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
'exclude' => get_post_thumbnail_id()
);
$attachments = get_posts($args);
$imageURL = array();
?>
<!-- Content -->
<div class="container">
<div class="row carousel-row">
<div class="col-md-12">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<?php $i=0; foreach ($attachments as $imageURL) { ?>
'<div class="item <?php if ($i == 0) { echo 'active'; } ?>" style="background-size:cover; background:url('<?php echo $imageURL[guid]; ?>') no-repeat center;">
<div class="carousel-caption">
<h4><?php echo $imageURL[post_excerpt];?></h4>
</div>
</div>
<?php $i++; } ?>
</div>
</div>