2026-10-12 14:43:32 +00:00

72 lines
3.3 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;
}
$teacher_ids = $args['teacher_ids'] ?? array();
$exclude_id = isset($args['exclude']) ? (int) $args['exclude'] : 0;
$limit = isset($args['limit']) ? (int) $args['limit'] : 0;
$description = isset($args['description']) ? $args['description'] : 'Опытные педагоги — действующие учителя начальных классов с высшим образованием.';
$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' => $limit > 0 ? $limit : -1,
'post_status' => 'publish',
);
if ($exclude_id > 0) {
$query_args['post__not_in'] = array( $exclude_id );
}
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);
$hub_url = function_exists('dekart_teachers_listing_url') ? dekart_teachers_listing_url() : '';
?>
<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="pksh-lead"><?php echo esc_html($description); ?></p>
<?php if (is_page_template('page-semejnye-klassy.php') && '' !== $hub_url) : ?>
<p class="pksh-lead"><a href="<?php echo esc_url($hub_url); ?>">Познакомиться со всеми преподавателями школы</a></p>
<?php endif; ?>
</div>
<div class="bento__full">
<?php if (is_page_template('page-semejnye-klassy.php')) : ?>
<div class="teachers-cards__scroll-hint" aria-hidden="true"><?php echo dekart_icon('arrow-down', 16); ?> Листайте, чтобы увидеть всех педагогов</div>
<?php endif; ?>
<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="<?php echo esc_url($hub_url ?: '/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>