This commit is contained in:
GP_DEV
2025-07-08 14:21:19 +03:00
parent a6bb81cbe1
commit 21562852ca
65 changed files with 7464 additions and 1073 deletions

181
single-trainer.php Normal file
View File

@@ -0,0 +1,181 @@
<?php
get_header();
// Получаем данные о тренере
$trainer_name = '';
$trainer_exp = '';
$trainer_short_desc = '';
if (have_rows('short_info')) {
while (have_rows('short_info')) {
the_row();
$trainer_name = get_sub_field('name');
$trainer_exp = get_sub_field('exp');
$trainer_short_desc = get_sub_field('short_desc');
}
}
$trainer_full_desc = '';
$trainer_desc_list = array();
$trainer_documents = array();
if (have_rows('full_info')) {
while (have_rows('full_info')) {
the_row();
$trainer_full_desc = get_sub_field('full_desc');
if (have_rows('desc_list')) {
while (have_rows('desc_list')) {
the_row();
$trainer_desc_list[] = get_sub_field('desc_list_item');
}
}
$documents = get_sub_field('documents');
if ($documents && is_array($documents)) {
$trainer_documents = $documents;
}
}
}
$trainer_photos = get_field('photo');
$trainer_trainings = get_field('trainings');
?>
<div class="py-[90px]">
<div class="container mx-auto">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-[60px] mb-[90px]">
<!-- Фото тренера -->
<div class="flex flex-col gap-[20px]">
<?php if ($trainer_photos && !empty($trainer_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($trainer_photos[0]['url']); ?>"
alt="<?php echo esc_attr($trainer_photos[0]['alt']); ?>"
class="w-full h-[600px] object-cover"/>
</div>
<?php endif; ?>
<!-- Дополнительные фото (если есть) -->
<?php if ($trainer_photos && count($trainer_photos) > 1): ?>
<div class="grid grid-cols-3 gap-[12px]">
<?php for ($i = 1; $i < min(4, count($trainer_photos)); $i++): ?>
<div class="rounded-[12px] overflow-hidden">
<img src="<?php echo esc_url($trainer_photos[$i]['url']); ?>"
alt="<?php echo esc_attr($trainer_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 ($trainer_exp): ?>
<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($trainer_exp); ?>
</div>
<?php endif; ?>
</div>
<?php if ($trainer_name): ?>
<h1 class="text-[48px] leading-[120%] font-[600] mb-[20px]">
<?php echo esc_html($trainer_name); ?>
</h1>
<?php endif; ?>
<?php if ($trainer_short_desc): ?>
<div class="text-[20px] leading-[150%] font-[500] text-[#6c6b6b] mb-[30px]">
<?php echo wp_kses_post($trainer_short_desc); ?>
</div>
<?php endif; ?>
<?php if ($trainer_full_desc): ?>
<div class="text-[16px] leading-[160%] font-[400] text-[#2B2C35] mb-[30px]">
<?php echo wp_kses_post($trainer_full_desc); ?>
</div>
<?php endif; ?>
<!-- Список достижений/квалификаций -->
<?php if (!empty($trainer_desc_list)): ?>
<div class="mb-[30px]">
<h3 class="text-[24px] leading-[125%] font-[600] mb-[16px]">Квалификация и достижения</h3>
<ul class="space-y-[8px]">
<?php foreach ($trainer_desc_list as $desc_item): ?>
<?php if ($desc_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($desc_item); ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<!-- Документы/сертификаты -->
<?php if ($trainer_documents && !empty($trainer_documents)): ?>
<div class="mb-[30px]">
<h3 class="text-[24px] leading-[125%] font-[600] mb-[16px]">Документы</h3>
<div class="space-y-[12px]">
<?php foreach ($trainer_documents as $document): ?>
<a href="<?php echo esc_url($document['url']); ?>"
target="_blank"
class="flex items-center gap-[12px] px-[20px] py-[12px] bg-[#f8f8f8] hover:bg-[#e0e0e0] rounded-[12px] text-[16px] leading-[145%] font-[500] 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="M17.5 12.5V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H4.16667C3.72464 17.5 3.30072 17.3244 2.98816 17.0118C2.67559 16.6993 2.5 16.2754 2.5 15.8333V12.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.83334 8.33333L10 12.5L14.1667 8.33333" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10 12.5V2.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<div class="flex flex-col">
<span><?php echo esc_html($document['filename']); ?></span>
<span class="text-[14px] text-[#6c6b6b]">
<?php echo esc_html(size_format($document['filesize'])); ?>
</span>
</div>
</a>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<!-- Связанные тренировки -->
<?php if ($trainer_trainings): ?>
<section class="py-[60px] px-[40px] bg-[#f8f8f8] rounded-[20px]">
<h2 class="text-[36px] leading-[125%] font-[600] mb-[40px] text-center">Тренировки с <?php echo esc_html($trainer_name ?: 'этим тренером'); ?></h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[24px]">
<?php foreach ($trainer_trainings as $post): ?>
<?php setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>"
class="block bg-white rounded-[16px] p-[24px] 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">
<h3 class="text-[20px] leading-[130%] font-[600] mb-[12px] text-[#2B2C35]">
<?php the_title(); ?>
</h3>
<?php if (has_excerpt()): ?>
<p class="text-[16px] leading-[150%] font-[400] text-[#6c6b6b]">
<?php echo wp_trim_words(get_the_excerpt(), 15, '...'); ?>
</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>
</a>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</div>
</section>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>