0
需要幫助,使循環是這樣的: http://prntscr.com/eswtytWordPress的自循環
隨着2箭頭樣式(左,右)。
1)與左箭頭2)與左箭頭項項 3)與右箭頭4)項與項右箭頭 5)與左箭頭6)與左箭頭 等物品的物品...
我現在的循環:
<?php
$services = get_posts(array(
'meta_query' => array(
array(
'key' => 'enable_service_in_homepage',
'compare' => '==',
'value' => '1'
)
)
));
if($services):
?>
<?php foreach($services as $post): setup_postdata($post) ?>
<div class="col-sm-6 nopadding">
<div class="item item-left">
<div class="col-sm-6 nopadding hidden-xs">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(700, 500)); ?></a>
<div class="arrow-left"></div>
</div>
<div class="col-md-6 nopadding">
<div class="content">
<h2><?php the_title(); ?></h2>
<p><?php echo wp_trim_words(get_the_content(), 35, '...'); ?></p>
<a href="<?php the_permalink(); ?>" class="service-button"><?php echo __('ƏTRAFLI','altus'); ?></a>
</div>
</div>
</div>
</div>
<!-- Start right arrow -->
<div class="col-sm-6 nopadding">
<div class="item item-right">
<div class="col-md-6 nopadding">
<div class="content">
<h2><?php the_title(); ?></h2>
<p><?php echo wp_trim_words(get_the_content(), 35, '...'); ?></p>
<a href="<?php the_permalink(); ?>" class="service-button"><?php echo __('ƏTRAFLI','altus'); ?></a>
</div>
</div>
<div class="col-sm-6 nopadding hidden-xs">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(700, 500)); ?></a>
<div class="arrow-right"></div>
</div>
</div>
</div>
<!-- End right arrow -->
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
那麼,這有什麼問題? – vlasits
抱歉我的英文不好。 即時需要幫助使圖片中的佈局,在我的循環現在只有左箭頭,有評論<! - 開始右箭頭 - >在哪裏開始右箭頭另一個佈局。需要這樣的網格: 1)項目與左箭頭2)項目與左箭頭 3)項目與右箭頭4)項目與右箭頭 5)項目與左箭頭6)項目與左箭頭 – Gr1m0n
我會建議您將省略代碼的後半部分(從右箭頭開始評論及其後),並從代碼的頂部刪除「左箭頭」類,並將代碼替換爲在「左箭頭」和「右箭頭」之間交替顯示的代碼。對」。你是否在尋找幫助來找出如何交替? – vlasits