feat(lightbox): 接入全站图片预览
This commit is contained in:
@@ -23,7 +23,7 @@ $lightbox = $args['lightbox'] ?? true;
|
||||
if (empty($images)) return;
|
||||
?>
|
||||
|
||||
<div class="content-gallery content-gallery--<?php echo esc_attr($layout); ?>" style="--gallery-columns: <?php echo $columns; ?>;">
|
||||
<div class="content-gallery content-gallery--<?php echo esc_attr($layout); ?><?php echo $lightbox ? ' aksrt-lightbox-trigger' : ''; ?>" data-aksrt-lightbox="<?php echo $lightbox ? '1' : '0'; ?>" style="--gallery-columns: <?php echo $columns; ?>;">
|
||||
<?php foreach ($images as $index => $img) :
|
||||
$src = $img['src'] ?? '';
|
||||
$alt = $img['alt'] ?? '';
|
||||
@@ -33,7 +33,7 @@ if (empty($images)) return;
|
||||
<figure class="content-gallery__item" data-index="<?php echo $index; ?>">
|
||||
<a href="<?php echo esc_url($src); ?>"
|
||||
class="content-gallery__link"
|
||||
<?php echo $lightbox ? 'data-lightbox="gallery"' : ''; ?>
|
||||
<?php echo $lightbox ? 'data-aksrt-lightbox-trigger="1"' : ''; ?>
|
||||
data-caption="<?php echo esc_attr($caption); ?>">
|
||||
<img<?php echo aksrt_get_lazy_attr('lazy_posts_content', (string) $src, 'content-gallery__img', aksrt_get_lazy_thumb('lg')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
alt="<?php echo esc_attr($alt); ?>"
|
||||
|
||||
Reference in New Issue
Block a user