0
我試圖將簡單的燈箱插件集成到高級自定義字段圖像字段中。WP:acf圖像字段和簡單的燈箱插件集成
基本上我希望單擊頁面上的任何圖像(通過acf圖像域填充)在lightbox中打開,並且還可以與lightbox中的所有其他圖像一起分組,以便像幻燈片一樣瀏覽它們。這是Simple Lightbox插件的內置功能,但我不知道如何將其與圖像字段的模板代碼相集成。
對於我使用這個ACF所見即所得領域...
<?php
$content = get_field('wysiwyg');
if (function_exists('slb_activate'))
$content = slb_activate($content);
echo $content;
?>
...偉大的工程,但是適應,要像場是躲避我。
這裏是我的像場模板代碼(不含在整合簡單燈箱任何企圖):
<?php
$image = get_field('img');
if(! empty($image)) {
$url = $image['url'];
$alt = $image['alt'];
$caption = $image['caption'];
$size = 'large';
$thumb = $image['sizes'][ $size ];
$width = $image['sizes'][ $size . '-width' ];
?>
<?php if($caption): ?>
<div class="wp-caption" style="width: <?php echo $width; ?>px">
<?php endif; ?>
<a href="<?php echo $url; ?>">
<img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" />
</a>
<?php if($caption): ?>
<p class="wp-caption-text"><?php echo $caption; ?></p>
</div>
<?php endif; ?>
<?php } ?>
對於如何簡單燈箱融入這個有什麼建議?提前致謝!
看到我更新的代碼。 – manishie 2014-09-26 22:27:20
非常感謝,但不幸的是,使用此代碼時,html輸出沒有改變。輸出看起來與上面使用我的原始代碼時一樣。任何其他想法? – dadra 2014-09-26 22:49:53
在最後一行發生了錯誤。此前我們迴應了未改變的$內容。這應該現在工作。 – manishie 2014-09-26 23:06:09