single-teacher.php

This commit is contained in:
Dekart Deploy Bot 2026-10-08 15:47:05 +00:00
parent 37affecc1d
commit 007adb9202
2 changed files with 12 additions and 3 deletions

View File

@ -1076,8 +1076,11 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
</section>
<?php
// ─── ДРУГИЕ ПРЕПОДАВАТЕЛИ ───
get_template_part('template-parts/teachers-cards');
// другие преподаватели: 4 карточки, без текущего
get_template_part('template-parts/teachers-cards', null, array(
'exclude' => get_the_ID(),
'limit' => 4,
));
?>
<?php

View File

@ -7,6 +7,8 @@ if (! defined('ABSPATH')) {
}
$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'] : 'Каждый педагог имеет опыт работы с дошкольниками от 5 лет. Все — действующие учителя начальных классов с высшим образованием.';
$hide_label = ! empty($args['hide_label']);
$title = isset($args['title']) ? $args['title'] : 'Наши преподаватели — практикующие педагоги';
@ -15,10 +17,14 @@ $cta_goal = isset($args['cta_goal']) ? (string) $args['cta_goal'] : '';
$query_args = array(
'post_type' => 'teacher',
'posts_per_page' => -1,
'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';