0
我正在使用高級自定義字段的Swipebox圖庫字段在Lightbox中顯示圖像。畫廊是通過按鈕激活的,並且在一個頁面上有多個畫廊(它們是循環的)。Swipebox和wordpress循環
<?php $i = 1; ?>
<?php
$loop = new WP_Query(array('post_type' => 'objektid'));
if ($loop->have_posts()) :
while ($loop->have_posts()) : $loop->the_post(); ?>
<div class="objektid_wrap">
<div class="right">
<div class="right_content">
<h2><?php echo get_the_title(); ?></h2>
<?php
$images = get_field('gallery');
if($images): ?>
<?php foreach($images as $image): ?>
<a class="thumb-link swipebox" href="<?php echo $image['url']; ?>" title="<?php echo $image['title']; ?>"><button>Vaata galeriid</button></a>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<div class="left">
<?php if (has_post_thumbnail()) { ?>
<?php the_post_thumbnail(); ?>
<?php } ?>
</div>
</div>
<?php if($i == 2) {
echo '<div class="arrow_box"><span class="ion-chevron-down"></span></div>';
} else {
echo '';
} ?>
<?php $i++; endwhile;
if ( $loop->max_num_pages > 1) : ?>
<?php endif;
endif;
?>
儘管swipebox在lightbox中查看時組合了所有圖庫圖像。畫廊從正確的幻燈片開始(例如第二個畫廊),但它包含所有幻燈片,包括第一個幻燈片。我的想法是,如何在第二個圖庫循環時爲swipebox實現刷新/重新初始化?
編輯:
Swipebox方式隔開經由相對畫廊= 「畫廊-1」 等 一種方式將被動態地添加rel = 「畫廊-X」 到每個滑動包
<div class="objektid_wrap">
<a class="thumb-link swipebox" rel="gallery-1"..
<a class="thumb-link swipebox" rel="gallery-1"..
</div>
<div class="objektid_wrap">
<a class="thumb-link swipebox" rel="gallery-2"..
<a class="thumb-link swipebox" rel="gallery-2"..
</div>
關於實現這個的任何想法?
祝