59 lines
2.7 KiB
PHP
59 lines
2.7 KiB
PHP
<?php
|
||
|
||
// Секция преподавателей (блок на страницах) — карточка общая с /our-teachers/
|
||
|
||
if (! defined('ABSPATH')) {
|
||
exit;
|
||
}
|
||
|
||
$teacher_ids = $args['teacher_ids'] ?? array();
|
||
$description = isset($args['description']) ? $args['description'] : 'Каждый педагог имеет опыт работы с дошкольниками от 5 лет. Все — действующие учителя начальных классов с высшим образованием.';
|
||
$hide_label = ! empty($args['hide_label']);
|
||
$title = isset($args['title']) ? $args['title'] : 'Наши преподаватели — практикующие педагоги';
|
||
$cta_label = isset($args['cta_label']) ? (string) $args['cta_label'] : '';
|
||
$cta_goal = isset($args['cta_goal']) ? (string) $args['cta_goal'] : '';
|
||
|
||
$query_args = array(
|
||
'post_type' => 'teacher',
|
||
'posts_per_page' => -1,
|
||
'post_status' => 'publish',
|
||
);
|
||
|
||
if (! empty($teacher_ids)) {
|
||
$query_args['post__in'] = $teacher_ids;
|
||
$query_args['orderby'] = 'post__in';
|
||
} else {
|
||
$query_args['orderby'] = 'date';
|
||
$query_args['order'] = 'DESC';
|
||
}
|
||
|
||
$teachers_query = new WP_Query($query_args);
|
||
// Отмеченные «первыми» — в начало
|
||
$teachers_query->posts = dekart_teachers_reorder_pinned($teachers_query->posts);
|
||
?>
|
||
<section class="bento teachers-cards" id="teachers" aria-label="Преподаватели">
|
||
<div class="bento__full section-header--centered">
|
||
<?php if (! $hide_label) : ?>
|
||
<span class="bento-label">Преподаватели</span>
|
||
<?php endif; ?>
|
||
<h2 class="bento-h2"><?php echo esc_html($title); ?></h2>
|
||
<p class="bento-p"><?php echo esc_html($description); ?></p>
|
||
</div>
|
||
<div class="bento__full">
|
||
<div class="teachers-cards__grid">
|
||
<?php if ($teachers_query->have_posts()) : ?>
|
||
<?php while ($teachers_query->have_posts()) : $teachers_query->the_post(); ?>
|
||
<?php get_template_part('template-parts/teachers/card', null, array( 'id' => get_the_ID(), 'cta_label' => $cta_label, 'cta_goal' => $cta_goal )); ?>
|
||
<?php endwhile; ?>
|
||
<?php wp_reset_postdata(); ?>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<div class="teachers-cards__footer">
|
||
<a class="teachers-cards__all-link" href="/our-teachers/">
|
||
Все преподаватели
|
||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14m-7-7 7 7-7 7"/></svg>
|
||
</a>
|
||
</div>
|
||
</section>
|