Swipebox and wordpress loop


Swipebox and wordpress loop

我使用Swipebox for Advanced Custom Fields画廊字段来显示灯箱中的图像。画廊是通过按钮激活的,在一个页面上有多个画廊(它们是循环的)。

    <?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结合了所有的画廊图像。图库从正确的幻灯片开始(例如第二个图库),但它包含所有幻灯片,包括第一个幻灯片。我的想法是如何实现刷刷盒刷新/重新初始化当第二个画廊是循环?

编辑:

Swipebox通过rel="gallery-1"等分隔画廊。一种方法是动态地为每个幻灯片包添加rel="gallery-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>

对实现这一点有什么想法吗?

最美好的祝愿

rel="gallery-<?php echo $i ?>"加入

解决
 <a class="thumb-link swipebox" href="<?php echo $image['url']; ?>" title="<?php echo $image['title']; ?>"><button>Vaata galeriid</button></a>