Files
Fakel-Gym/single-training.php
GP_DEV 21562852ca full
2025-07-08 14:21:19 +03:00

235 lines
13 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
get_header();
// Получаем данные о тренировке
$training_name = '';
$training_short_desc = '';
$training_difficulty = '';
if (have_rows('short_info')) {
while (have_rows('short_info')) {
the_row();
$training_name = get_sub_field('name');
$training_short_desc = get_sub_field('short_desc');
$training_difficulty = get_sub_field('dificulty');
}
}
$training_full_desc = '';
$training_duration = '';
$what_happens_list = array();
$for_who_list = array();
if (have_rows('full_info')) {
while (have_rows('full_info')) {
the_row();
$training_full_desc = get_sub_field('full_desc');
$training_duration = get_sub_field('duration');
if (have_rows('what_happens')) {
while (have_rows('what_happens')) {
the_row();
$what_happens_list[] = get_sub_field('list_element');
}
}
if (have_rows('for_who')) {
while (have_rows('for_who')) {
the_row();
$for_who_list[] = get_sub_field('list_element');
}
}
}
}
$training_photos = get_field('photo');
$training_trainers = get_field('trainers');
?>
<div class="py-[90px]">
<div class="container mx-auto">
<!-- Навигация назад -->
<div class="mb-[40px]">
<a href="<?php echo get_post_type_archive_link('training'); ?>"
class="inline-flex items-center gap-[8px] text-[16px] leading-[145%] font-[500] text-[#6c6b6b] hover:text-[#2B2C35] transition-colors duration-300">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.5 15L7.5 10L12.5 5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Все тренировки
</a>
</div>
<!-- Основная информация -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-[60px] mb-[90px]">
<!-- Фото тренировки -->
<div class="flex flex-col gap-[20px]">
<?php if ($training_photos && !empty($training_photos[0])): ?>
<div class="rounded-[20px] overflow-hidden shadow-[0_2px_32px_0_rgba(16,_15,_15,_0.03)]">
<img src="<?php echo esc_url($training_photos[0]['url']); ?>"
alt="<?php echo esc_attr($training_photos[0]['alt']); ?>"
class="w-full h-[600px] object-cover"/>
</div>
<?php endif; ?>
<!-- Дополнительные фото (если есть) -->
<?php if ($training_photos && count($training_photos) > 1): ?>
<div class="grid grid-cols-3 gap-[12px]">
<?php for ($i = 1; $i < min(4, count($training_photos)); $i++): ?>
<div class="rounded-[12px] overflow-hidden">
<img src="<?php echo esc_url($training_photos[$i]['url']); ?>"
alt="<?php echo esc_attr($training_photos[$i]['alt']); ?>"
class="w-full h-[120px] object-cover"/>
</div>
<?php endfor; ?>
</div>
<?php endif; ?>
</div>
<!-- Информация о тренировке -->
<div class="flex flex-col">
<div class="flex gap-[8px] mb-[20px]">
<div class="text-[15px] leading-[110%] font-[600] text-[#fff] px-[12px] h-[29px] flex items-center justify-center rounded-[32px] backdrop-blur-[8px] bg-[linear-gradient(90deg,rgba(157,153,148,0.7)_39.42%,rgba(197,197,185,0.7)_92.9%)]">
<?php echo pll_current_language('name'); ?>
</div>
<?php if ($training_difficulty): ?>
<div class="text-[15px] leading-[110%] font-[600] text-[#fff] px-[12px] h-[29px] flex items-center justify-center rounded-[32px] backdrop-blur-[8px] bg-[linear-gradient(90deg,rgba(157,153,148,0.7)_39.42%,rgba(197,197,185,0.7)_92.9%)]">
<?php echo esc_html($training_difficulty); ?>
</div>
<?php endif; ?>
<?php if ($training_duration): ?>
<div class="text-[15px] leading-[110%] font-[600] text-[#fff] px-[12px] h-[29px] flex items-center justify-center rounded-[32px] backdrop-blur-[8px] bg-[linear-gradient(90deg,rgba(157,153,148,0.7)_39.42%,rgba(197,197,185,0.7)_92.9%)]">
<?php echo esc_html($training_duration); ?>
</div>
<?php endif; ?>
</div>
<?php if ($training_name): ?>
<h1 class="text-[48px] leading-[120%] font-[600] mb-[20px]">
<?php echo esc_html($training_name); ?>
</h1>
<?php endif; ?>
<?php if ($training_short_desc): ?>
<div class="text-[20px] leading-[150%] font-[500] text-[#6c6b6b] mb-[30px]">
<?php echo wp_kses_post($training_short_desc); ?>
</div>
<?php endif; ?>
<?php if ($training_full_desc): ?>
<div class="text-[16px] leading-[160%] font-[400] text-[#2B2C35] mb-[30px]">
<?php echo wp_kses_post($training_full_desc); ?>
</div>
<?php endif; ?>
<!-- Что происходит на тренировке -->
<?php if (!empty($what_happens_list)): ?>
<div class="mb-[30px]">
<h3 class="text-[24px] leading-[125%] font-[600] mb-[16px]">Что происходит на тренировке</h3>
<ul class="space-y-[8px]">
<?php foreach ($what_happens_list as $what_happens_item): ?>
<?php if ($what_happens_item): ?>
<li class="flex items-start gap-[12px] text-[16px] leading-[160%] font-[400] text-[#2B2C35]">
<div class="w-[6px] h-[6px] rounded-full bg-[#E21E24] mt-[10px] flex-shrink-0"></div>
<?php echo wp_kses_post($what_happens_item); ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<!-- Для кого подходит -->
<?php if (!empty($for_who_list)): ?>
<div class="mb-[30px]">
<h3 class="text-[24px] leading-[125%] font-[600] mb-[16px]">Для кого подходит</h3>
<ul class="space-y-[8px]">
<?php foreach ($for_who_list as $for_who_item): ?>
<?php if ($for_who_item): ?>
<li class="flex items-start gap-[12px] text-[16px] leading-[160%] font-[400] text-[#2B2C35]">
<div class="w-[6px] h-[6px] rounded-full bg-[#E21E24] mt-[10px] flex-shrink-0"></div>
<?php echo wp_kses_post($for_who_item); ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
</div>
<!-- Тренеры -->
<?php if ($training_trainers): ?>
<section class="py-[60px] px-[40px] bg-[#f8f8f8] rounded-[20px]">
<h2 class="text-[36px] leading-[125%] font-[600] mb-[40px] text-center">Тренеры</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-[24px]">
<?php foreach ($training_trainers as $post): ?>
<?php setup_postdata($post); ?>
<?php
// Получаем данные тренера
$trainer_name = '';
$trainer_exp = '';
$trainer_short_desc = '';
if (have_rows('short_info', $post->ID)) {
while (have_rows('short_info', $post->ID)) {
the_row();
$trainer_name = get_sub_field('name');
$trainer_exp = get_sub_field('exp');
$trainer_short_desc = get_sub_field('short_desc');
}
}
$trainer_photos = get_field('photo', $post->ID);
?>
<a href="<?php the_permalink(); ?>"
class="block bg-white rounded-[16px] overflow-hidden shadow-[0_2px_16px_0_rgba(16,_15,_15,_0.08)] hover:shadow-[0_8px_32px_0_rgba(16,_15,_15,_0.12)] transition-shadow duration-300">
<?php if ($trainer_photos && !empty($trainer_photos[0])): ?>
<div class="h-[280px] overflow-hidden">
<img src="<?php echo esc_url($trainer_photos[0]['url']); ?>"
alt="<?php echo esc_attr($trainer_photos[0]['alt']); ?>"
class="w-full h-full object-cover"/>
</div>
<?php endif; ?>
<div class="p-[20px]">
<div class="flex gap-[4px] mb-[12px]">
<div class="text-[13px] leading-[110%] font-[600] text-[#fff] px-[10px] h-[24px] flex items-center justify-center rounded-[32px] backdrop-blur-[8px] bg-[linear-gradient(90deg,rgba(157,153,148,0.7)_39.42%,rgba(197,197,185,0.7)_92.9%)]">
<?php echo pll_current_language('name'); ?>
</div>
<?php if ($trainer_exp): ?>
<div class="text-[13px] leading-[110%] font-[600] text-[#fff] px-[10px] h-[24px] flex items-center justify-center rounded-[32px] backdrop-blur-[8px] bg-[linear-gradient(90deg,rgba(157,153,148,0.7)_39.42%,rgba(197,197,185,0.7)_92.9%)]">
<?php echo esc_html($trainer_exp); ?>
</div>
<?php endif; ?>
</div>
<?php if ($trainer_name): ?>
<h3 class="text-[20px] leading-[130%] font-[600] mb-[8px] text-[#2B2C35]">
<?php echo esc_html($trainer_name); ?>
</h3>
<?php endif; ?>
<?php if ($trainer_short_desc): ?>
<p class="text-[14px] leading-[150%] font-[400] text-[#6c6b6b]">
<?php echo wp_trim_words($trainer_short_desc, 12, '...'); ?>
</p>
<?php endif; ?>
<div class="mt-[16px] flex items-center gap-[8px] text-[14px] leading-[140%] font-[500] text-[#E21E24]">
Подробнее
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 12L10 8L6 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
</div>
</a>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</div>
</section>
<?php endif; ?>
</div>
</div>
<div id="mf_schedule_widget_cont_au1"></div>
<div id="mf_personal_widget_cont_ksm"></div>
<?php get_footer(); ?>