2026-10-12 15:08:05 +00:00

53 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// Фотогалерея
if (! defined('ABSPATH')) {
exit;
}
$data = Pksh_Data::instance();
$gallery = $data->get_gallery();
if (empty($gallery) || ! is_array($gallery)) {
return;
}
?>
<section class="bento pksh-section" id="gallery" aria-label="Фотогалерея">
<div class="bento__full section-header--left">
<span class="bento-label">Фотогалерея</span>
<h2 class="bento-h2">Фото с занятий</h2>
<p class="pksh-lead"><?php echo esc_html('Фотографии с наших уроков — посмотрите, как увлекательно и продуктивно проходят занятия' . ('' !== (string) $data->get_name() ? ' в центре «' . $data->get_name() . '»' : '') . '.'); ?></p>
</div>
<div class="bento__full">
<div class="pksh-gallery__grid">
<?php foreach ($gallery as $item) :
$img_id = $item['gallery_image'] ?? 0;
$caption = $item['gallery_caption'] ?? '';
if (empty($img_id)) {
continue;
}
$img_full = wp_get_attachment_image_url($img_id, 'full');
$img_thumb = wp_get_attachment_image_url($img_id, 'medium_large');
$img_alt = $caption ? wp_strip_all_tags($caption) : esc_attr__('Фото занятия', 'dekart');
if (empty($img_full) || empty($img_thumb)) {
continue;
}
?>
<figure class="pksh-gallery__item">
<img class="pksh-gallery__img" src="<?php echo esc_url($img_thumb); ?>"
alt="<?php echo esc_attr($img_alt); ?>"
loading="lazy" decoding="async">
<?php if ($caption) : ?>
<figcaption class="pksh-gallery__caption"><?php echo esc_html($caption); ?></figcaption>
<?php endif; ?>
</figure>
<?php endforeach; ?>
</div>
</div>
</section>
<?php