Lightbox ACF中继器单图像



我在ACF中有一些带有单个图像的中继器字段。葬图像必须有一个灯箱。默认情况下它不起作用。

我知道,必须激活slb activate()。我可以找到Howto在ACF中的画廊中如何执行此操作,但没有为ACF中继器中的单个图像。

这是我的代码:

 <?php elseif(get_row_layout() == "verdiepingen"): ?>
 <?php if( have_rows('verdiepingen') ): ?>
 <?php while( have_rows('verdiepingen') ): the_row();       
 // vars
 $image = get_sub_field('afbeelding_verdieping');
 $content = get_sub_field('content_verdieping');
 $plattegrondlinks = get_sub_field('plattegrond_verdieping_links');
 $plattegrondrechts = get_sub_field('plattegrond_verdieping_rechts');         $penthouse 
 ?>
 <img src="<?php echo $plattegrondlinks['url']; ?>" alt="<?php echo $plattegrondlinks['alt'] ?>" class="img-responsive" />

你好quinox

我可能是错的,但我相信您需要用锚固链接将图像包裹到图像中,该图像应在Lightbox中打开。因此,您的html在循环内部应该以某种方式看起来像

<a href="<?php echo $plattegrondlinks['url']; ?>" title="Lightbox link - please check documentation of Lightbox" class="lightbox">
    <img src="<?php echo $plattegrondlinks['url']; ?>" alt="<?php echo $plattegrondlinks['alt'] ?>" class="img-responsive" />
</a>

考虑将较小的图像放在预览中 - 您的页面将加载更快。让我知道这是否有帮助。

最新更新