2026-10-05 GLOBAL
This commit is contained in:
parent
affe75eb18
commit
7f714d8e9f
@ -11518,26 +11518,33 @@ main > .pksh-section:first-child {
|
||||
}
|
||||
|
||||
/* ── 20. Teachers Cards (shared) ── */
|
||||
/* Сетка карточек (общая для /our-teachers/ и блока «Наши преподаватели») */
|
||||
/* Сетка карточек (общая для /our-teachers/ и блока «Наши преподаватели»).
|
||||
flex + justify-content:center → неполный последний ряд центрируется на десктопе */
|
||||
.teachers-cards__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: clamp(14px, 1.6vw, 22px);
|
||||
--tcg-gap: clamp(14px, 1.6vw, 22px);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: var(--tcg-gap);
|
||||
}
|
||||
.teachers-cards__grid > .teachers-card {
|
||||
width: calc((100% - 3 * var(--tcg-gap)) / 4 - 0.02px);
|
||||
height: auto;
|
||||
}
|
||||
/* Широкий десктоп — по 5 карточек в ряд */
|
||||
@media (min-width: 1440px) {
|
||||
.teachers-cards__grid {
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
.teachers-cards__grid > .teachers-card {
|
||||
width: calc((100% - 4 * var(--tcg-gap)) / 5 - 0.02px);
|
||||
}
|
||||
}
|
||||
@media (max-width: 1024px) {
|
||||
.teachers-cards__grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
.teachers-cards__grid > .teachers-card {
|
||||
width: calc((100% - 1 * var(--tcg-gap)) / 2 - 0.02px);
|
||||
}
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.teachers-cards__grid {
|
||||
grid-template-columns: 1fr;
|
||||
.teachers-cards__grid > .teachers-card {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
/* Карточка преподавателя (общая: /our-teachers/ и блок «Наши преподаватели») */
|
||||
@ -11592,6 +11599,7 @@ main > .pksh-section:first-child {
|
||||
left: 10px;
|
||||
bottom: 10px;
|
||||
max-width: calc(100% - 20px);
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
border-radius: var(--radius-pill, 100px);
|
||||
background: rgba(255, 255, 255, .9);
|
||||
@ -11599,6 +11607,8 @@ main > .pksh-section:first-child {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
text-align: center;
|
||||
text-wrap: balance;
|
||||
box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
|
||||
}
|
||||
.teachers-card__body {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -3378,6 +3378,34 @@ add_shortcode('faq', function ($atts, $content = null) {
|
||||
*
|
||||
* @return array<int,array<int,int>>
|
||||
*/
|
||||
// Сортировка отзывов по дате: новые выше (независимо от ФИО/порядка CF/преподавателя)
|
||||
function dekart_review_item_ts($item): int
|
||||
{
|
||||
if (is_numeric($item)) {
|
||||
return (int) get_post_time('U', false, (int) $item);
|
||||
}
|
||||
$d = is_array($item) ? trim((string) ( $item['review_date'] ?? '' )) : trim((string) $item);
|
||||
if ('' === $d) {
|
||||
return 0;
|
||||
}
|
||||
if (preg_match('/^(\d{2})\.(\d{2})\.(\d{4})$/', $d, $m)) {
|
||||
return (int) strtotime($m[3] . '-' . $m[2] . '-' . $m[1]);
|
||||
}
|
||||
$ts = strtotime($d);
|
||||
return $ts ? (int) $ts : 0;
|
||||
}
|
||||
|
||||
function dekart_reviews_sort_desc(array $items): array
|
||||
{
|
||||
if (count($items) < 2) {
|
||||
return array_values($items);
|
||||
}
|
||||
usort($items, static function ($a, $b) {
|
||||
return dekart_review_item_ts($b) <=> dekart_review_item_ts($a);
|
||||
});
|
||||
return array_values($items);
|
||||
}
|
||||
|
||||
function dekart_teacher_review_map(): array
|
||||
{
|
||||
static $map = null;
|
||||
@ -3481,7 +3509,7 @@ function dekart_teacher_review_counts(): array
|
||||
function dekart_teacher_review_ids(int $teacher_id): array
|
||||
{
|
||||
$map = dekart_teacher_review_map();
|
||||
return isset($map[ $teacher_id ]) ? array_map('intval', $map[ $teacher_id ]) : array();
|
||||
return isset($map[ $teacher_id ]) ? dekart_reviews_sort_desc(array_map('intval', $map[ $teacher_id ])) : array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1085,6 +1085,10 @@ function dekart_schema_reviews(): array
|
||||
return array();
|
||||
}
|
||||
|
||||
if (function_exists('dekart_reviews_sort_desc')) {
|
||||
$reviews = dekart_reviews_sort_desc($reviews);
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$review_seq = 0;
|
||||
foreach ($reviews as $i => $review) {
|
||||
|
||||
@ -584,14 +584,14 @@ $metrics = [
|
||||
$review_items = carbon_get_post_meta($post_id, 'camp_reviews_list');
|
||||
$total_count = is_array($review_items) ? count($review_items) : 0;
|
||||
if ($total_count > 0) :
|
||||
$items = array_values($review_items);
|
||||
$card_idx = 0;
|
||||
?>
|
||||
<div class="reviews-cards">
|
||||
<div class="lw-scroll-x">
|
||||
<div class="lw-grid lw-grid--3">
|
||||
<?php foreach ($items as $item) :
|
||||
$card_idx++;
|
||||
$items = dekart_reviews_sort_desc(array_values($review_items));
|
||||
$card_idx = 0;
|
||||
?>
|
||||
<div class="reviews-cards">
|
||||
<div class="lw-scroll-x">
|
||||
<div class="lw-grid lw-grid--3">
|
||||
<?php foreach ($items as $item) :
|
||||
$card_idx++;
|
||||
$author = $item['review_author'] ?? '';
|
||||
$text = $item['review_text'] ?? '';
|
||||
$raw_rating = $item['review_rating'] ?? '';
|
||||
|
||||
@ -430,7 +430,7 @@ if ('' === (string) $reviews_h1) {
|
||||
$reviews_cards = array();
|
||||
}
|
||||
|
||||
$reviews_cards = array_reverse($reviews_cards);
|
||||
$reviews_cards = dekart_reviews_sort_desc($reviews_cards);
|
||||
|
||||
if (! empty($reviews_cards)) :
|
||||
$card_idx = 0;
|
||||
@ -1149,7 +1149,7 @@ $schema_cards = carbon_get_post_meta($post_id, 'reviews_cards');
|
||||
if (! is_array($schema_cards)) {
|
||||
$schema_cards = array();
|
||||
}
|
||||
$schema_cards = array_reverse($schema_cards);
|
||||
$schema_cards = dekart_reviews_sort_desc($schema_cards);
|
||||
|
||||
foreach ($schema_cards as $card) {
|
||||
$text = isset($card['review_text']) ? trim((string) $card['review_text']) : '';
|
||||
|
||||
@ -31,7 +31,8 @@ $args = array(
|
||||
|
||||
if (! empty($review_ids)) {
|
||||
$args['post__in'] = $review_ids;
|
||||
$args['orderby'] = 'post__in';
|
||||
$args['orderby'] = 'date';
|
||||
$args['order'] = 'DESC';
|
||||
$args['posts_per_page'] = count($review_ids);
|
||||
} else {
|
||||
$args['meta_query'] = array(
|
||||
|
||||
@ -24,7 +24,7 @@ $total_count = count($review_items);
|
||||
|
||||
<div class="bento__full">
|
||||
<?php if ($total_count > 0) :
|
||||
$items = array_values($review_items);
|
||||
$items = dekart_reviews_sort_desc(array_values($review_items));
|
||||
$card_idx = 0;
|
||||
?>
|
||||
<div class="reviews-cards">
|
||||
|
||||
@ -75,7 +75,7 @@ if ($teacher_filter) {
|
||||
$has_reviews = ! empty($reviews_cards) && is_array($reviews_cards);
|
||||
|
||||
if ($has_reviews) {
|
||||
$reviews_cards = array_slice(array_reverse($reviews_cards), 0, 3);
|
||||
$reviews_cards = array_slice(dekart_reviews_sort_desc($reviews_cards), 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,18 +9,38 @@ if (! defined('ABSPATH')) {
|
||||
$post_id = (int) get_the_ID();
|
||||
$faq = carbon_get_post_meta($post_id, 'teachers_faq');
|
||||
|
||||
if (empty($faq) || ! is_array($faq)) {
|
||||
return;
|
||||
$faq_items = array();
|
||||
if (is_array($faq)) {
|
||||
foreach ($faq as $item) {
|
||||
$q = $item['faq_question'] ?? '';
|
||||
$a = $item['faq_answer'] ?? '';
|
||||
if (! $q || ! $a) {
|
||||
continue;
|
||||
}
|
||||
$faq_items[] = array( 'q' => $q, 'a' => $a );
|
||||
}
|
||||
}
|
||||
|
||||
$faq_items = array();
|
||||
foreach ($faq as $item) {
|
||||
$q = $item['faq_question'] ?? '';
|
||||
$a = $item['faq_answer'] ?? '';
|
||||
if (! $q || ! $a) {
|
||||
continue;
|
||||
}
|
||||
$faq_items[] = array( 'q' => $q, 'a' => $a );
|
||||
if (empty($faq_items)) {
|
||||
// Дефолтный FAQ (без CF)
|
||||
$faq_items = array(
|
||||
array(
|
||||
'q' => 'Как ребёнка знакомят с новым учителем?',
|
||||
'a' => 'Перед началом занятий проводим знакомство: ребёнок встречается с учителем, знакомится с классом и расписанием. Первые дни педагог уделяет особое внимание адаптации и мягко вводит ребёнка в учебный процесс.',
|
||||
),
|
||||
array(
|
||||
'q' => 'Мой ребёнок стеснительный. Как учитель поможет ему адаптироваться?',
|
||||
'a' => 'В мини-группах педагог видит каждого ребёнка и подбирает задания по силам. Стеснительным детям даём больше времени на ответ, поддерживаем и постепенно включаем в общую работу, чтобы не создавать стресс.',
|
||||
),
|
||||
array(
|
||||
'q' => 'Можно ли выбрать учителя?',
|
||||
'a' => 'Мы учитываем пожелания родителей и особенности ребёнка при распределении по группам. На бесплатной диагностике обсуждаем, какой формат и педагог подойдут лучше всего.',
|
||||
),
|
||||
array(
|
||||
'q' => 'Как часто меняются учителя в школе?',
|
||||
'a' => 'Наша команда стабильна: педагоги работают в школе годами. Ребёнок занимается с постоянным учителем, что помогает выстроить доверие и не менять привычный формат обучения.',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($faq_items)) {
|
||||
|
||||
@ -14,7 +14,11 @@ if (empty($flt_title)) {
|
||||
}
|
||||
|
||||
if (empty($filters) || ! is_array($filters)) {
|
||||
$filters = array();
|
||||
// Дефолт без CF — направления школы
|
||||
$filters = array(
|
||||
array( 'filter_label' => 'Начальная школа', 'filter_slug' => 'nachalnaya-shkola' ),
|
||||
array( 'filter_label' => 'Подготовка к школе', 'filter_slug' => 'podgotovka-k-shkole' ),
|
||||
);
|
||||
}
|
||||
|
||||
// «Все» — всегда первый фильтр
|
||||
|
||||
@ -8,14 +8,24 @@ if (! defined('ABSPATH')) {
|
||||
|
||||
$post_id = (int) get_the_ID();
|
||||
|
||||
$intro_city = get_option('branch_city') ?: carbon_get_theme_option('site_city');
|
||||
$intro_brand = get_option('branch_name') ?: get_bloginfo('name');
|
||||
|
||||
$intro_title = carbon_get_post_meta($post_id, 'teachers_intro_title');
|
||||
if (empty($intro_title)) {
|
||||
$intro_title = 'Преподаватели школы «Декарт» в Щёлково';
|
||||
$intro_title = 'Преподаватели школы «' . $intro_brand . '»' . ( $intro_city ? ' в ' . $intro_city : '' );
|
||||
}
|
||||
|
||||
$intro_text = carbon_get_post_meta($post_id, 'teachers_intro_text');
|
||||
if (empty($intro_text)) {
|
||||
return;
|
||||
// Дефолт без хардкода города/цифр
|
||||
$intro_count = (int) wp_count_posts('teacher')->publish;
|
||||
$intro_where = 'школе «' . $intro_brand . '»' . ( $intro_city ? ' в ' . $intro_city : '' );
|
||||
$intro_text = sprintf(
|
||||
'В %s преподают %d педагогов: учителя начальных классов, предметники средней и старшей школы, логопед, психолог и воспитатели продлёнки. Все педагоги имеют высшее образование и регулярно проходят курсы повышения квалификации.',
|
||||
$intro_where,
|
||||
$intro_count
|
||||
);
|
||||
}
|
||||
|
||||
// Контекстные ссылки
|
||||
|
||||
@ -9,18 +9,45 @@ if (! defined('ABSPATH')) {
|
||||
$post_id = (int) get_the_ID();
|
||||
$trust = carbon_get_post_meta($post_id, 'teachers_trust');
|
||||
|
||||
if (empty($trust) || ! is_array($trust)) {
|
||||
return;
|
||||
$trust_items = array();
|
||||
if (is_array($trust)) {
|
||||
foreach ($trust as $t) {
|
||||
$num = $t['trust_number'] ?? '';
|
||||
$label = $t['trust_label'] ?? '';
|
||||
if (! $num || ! $label) {
|
||||
continue;
|
||||
}
|
||||
$trust_items[] = array( 'num' => $num, 'label' => $label );
|
||||
}
|
||||
}
|
||||
|
||||
$trust_items = array();
|
||||
foreach ($trust as $t) {
|
||||
$num = $t['trust_number'] ?? '';
|
||||
$label = $t['trust_label'] ?? '';
|
||||
if (! $num || ! $label) {
|
||||
continue;
|
||||
if (empty($trust_items)) {
|
||||
// Дефолт без хардкода — считаем из данных
|
||||
$teachers_count = (int) wp_count_posts('teacher')->publish;
|
||||
$years = array();
|
||||
$cur = (int) current_time('Y');
|
||||
foreach (get_posts(array(
|
||||
'post_type' => 'teacher',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => -1,
|
||||
'fields' => 'ids',
|
||||
'no_found_rows' => true,
|
||||
)) as $tid) {
|
||||
$sy = (int) get_post_meta($tid, '_teacher_start_year', true);
|
||||
if ($sy > 1900 && $sy <= $cur) {
|
||||
$years[] = $cur - $sy;
|
||||
}
|
||||
}
|
||||
$trust_items[] = array( 'num' => $num, 'label' => $label );
|
||||
$avg_years = $years ? (int) round(array_sum($years) / count($years)) : 0;
|
||||
$group = get_option('branch_group_size') ?: '2-6';
|
||||
|
||||
if ($teachers_count) {
|
||||
$trust_items[] = array( 'num' => (string) $teachers_count, 'label' => 'педагогов в команде' );
|
||||
}
|
||||
if ($avg_years) {
|
||||
$trust_items[] = array( 'num' => $avg_years, 'label' => 'лет — средний педагогический стаж' );
|
||||
}
|
||||
$trust_items[] = array( 'num' => $group, 'label' => 'человек в мини-группе — внимание как на репетиторе' );
|
||||
}
|
||||
|
||||
if (empty($trust_items)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user