2026-08-30 15:07:57 +00:00

91 lines
5.2 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
/**
* Секция «Программа» страницы класса начальной школы.
* Вкладка «📚 Программа»: описание + карточки предметов + галерея фото.
*
* @package Dekart
*/
if (! defined('ABSPATH')) {
exit;
}
$post_id = (int) get_the_ID();
$program_title = crb_get_post_meta($post_id, 'class_program_title', 'Программа обучения');
$program_text = crb_get_post_meta($post_id, 'class_program_text', '');
$program_items = crb_get_post_meta($post_id, 'class_program_items');
$gallery = crb_get_post_meta($post_id, 'class_program_gallery');
if (empty($program_items) || ! is_array($program_items)) {
$program_items = array(
array('item_icon' => 'chart-bar', 'item_title' => 'Математика', 'item_text' => 'Счёт, логика и решение задач. Учим думать, а не запоминать.'),
array('item_icon' => 'book', 'item_title' => 'Русский язык', 'item_text' => 'Грамотное письмо и речь. Чистописание и разбор правил.'),
array('item_icon' => 'book-2', 'item_title' => 'Литературное чтение', 'item_text' => 'Скорочтение и понимание текста. Классика и современная детская литература.'),
array('item_icon' => 'star', 'item_title' => 'Английский язык', 'item_text' => 'Ежедневные уроки: говорение, чтение и лексика в игровой форме.'),
array('item_icon' => 'school', 'item_title' => 'Окружающий мир', 'item_text' => 'Природа, общество и безопасность. Проекты и наблюдения.'),
array('item_icon' => 'heart', 'item_title' => 'Физкультура и здоровье', 'item_text' => 'Подвижные игры, осанка и режим. Спортивные секции после уроков.'),
array('item_icon' => 'bulb', 'item_title' => 'Творчество', 'item_text' => 'Музыка, изобразительное искусство и театральная студия.'),
array('item_icon' => 'medal-2', 'item_title' => 'Логика и шахматы', 'item_text' => 'Развитие мышления, памяти и внимания через интеллектуальные игры.'),
);
}
$icons_dir = get_template_directory_uri() . '/assets/images/icons/';
?>
<section class="class-program section-bg" data-bg="class-program" id="class-program" aria-labelledby="class-program-title">
<div class="container">
<div class="section-header--left">
<h2 id="class-program-title" class="bento-h2"><?php echo esc_html($program_title); ?></h2>
<?php if ($program_text) : ?>
<div class="bento-p class-program__text"><?php echo wp_kses_post($program_text); ?></div>
<?php endif; ?>
</div>
<ul class="class-program__grid">
<?php foreach ($program_items as $item) :
$icon = isset($item['item_icon']) ? sanitize_title($item['item_icon']) : 'book';
$title = isset($item['item_title']) ? trim($item['item_title']) : '';
$text = isset($item['item_text']) ? trim($item['item_text']) : '';
if ('' === $title) {
continue;
}
?>
<li class="class-program__card">
<span class="class-program__icon" aria-hidden="true">
<img src="<?php echo esc_url($icons_dir . $icon . '.svg'); ?>"
alt="" loading="lazy" width="28" height="28"
onerror="this.src='<?php echo esc_url($icons_dir . 'book.svg'); ?>'">
</span>
<h3 class="class-program__card-title"><?php echo esc_html($title); ?></h3>
<?php if ($text) : ?>
<p class="class-program__card-text"><?php echo esc_html($text); ?></p>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php if (is_array($gallery) && ! empty($gallery)) : ?>
<div class="class-program__gallery">
<?php foreach ($gallery as $i => $item) :
$img_id = isset($item['gallery_image']) ? (int) $item['gallery_image'] : 0;
if ($img_id < 1) {
continue;
}
$src = wp_get_attachment_image_url($img_id, 'medium_large');
$alt = get_post_meta($img_id, '_wp_attachment_image_alt', true) ?: $program_title;
if (! $src) {
continue;
}
?>
<figure class="class-program__gallery-item<?php echo 0 === $i ? ' class-program__gallery-item--wide' : ''; ?>">
<img src="<?php echo esc_url($src); ?>" alt="<?php echo esc_attr($alt); ?>" loading="lazy" decoding="async">
</figure>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</section>