2026-10-03 GLOBAL
This commit is contained in:
parent
e1ae8e89f5
commit
206b7bb2e9
@ -11537,6 +11537,22 @@ main > .pksh-section:first-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
/* Карточка-ссылка на страницу педагога */
|
||||
.teachers-cards__card-link {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
border-radius: inherit;
|
||||
}
|
||||
.teachers-cards__card-link:focus-visible {
|
||||
outline: 3px solid var(--color-primary);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
.teachers-cards__card .teachers-cards__btn {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
.teachers-cards__card:hover {
|
||||
transform: translateY(-4px);
|
||||
|
||||
@ -3286,6 +3286,25 @@ function dekart_teacher_review_avg(int $teacher_id): float
|
||||
return $cache[ $teacher_id ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Склонение «год/года/лет» для стажа.
|
||||
*/
|
||||
function dekart_years_plural(int $years): string
|
||||
{
|
||||
$n = abs($years) % 100;
|
||||
$n1 = $n % 10;
|
||||
if ($n > 10 && $n < 20) {
|
||||
return 'лет';
|
||||
}
|
||||
if ($n1 > 1 && $n1 < 5) {
|
||||
return 'года';
|
||||
}
|
||||
if ($n1 === 1) {
|
||||
return 'год';
|
||||
}
|
||||
return 'лет';
|
||||
}
|
||||
|
||||
/**
|
||||
* OG-изображение 1200×630 для страницы «Преподаватели».
|
||||
* Глобальный дефолт Yoast (banner-dekart-small.webp 355×250) даёт битый сниппет.
|
||||
|
||||
@ -327,7 +327,7 @@ if (is_array($cf_results) && ! empty($cf_results)) {
|
||||
} else {
|
||||
if (! empty($school_num)) { $results[] = array( 'result_title' => (string) $school_num, 'result_text' => $school_label ); }
|
||||
if ($avg_score) { $results[] = array( 'result_title' => $avg_score, 'result_text' => $avg_label ); }
|
||||
if ($tenure) { $results[] = array( 'result_title' => $tenure . ' лет', 'result_text' => 'педагогический стаж преподавателя' ); }
|
||||
if ($tenure) { $results[] = array( 'result_title' => $tenure . ' ' . dekart_years_plural((int) $tenure), 'result_text' => 'педагогический стаж преподавателя' ); }
|
||||
if ($review_count > 0) { $results[] = array( 'result_title' => (string) $review_count, 'result_text' => 'реальных отзывов родителей о преподавателе' ); }
|
||||
}
|
||||
|
||||
@ -351,8 +351,11 @@ if (! empty($subject_names)) {
|
||||
$person['knowsAbout'] = $subject_names;
|
||||
}
|
||||
$diploma = trim((string) carbon_get_post_meta($tid, 'teacher_diploma'));
|
||||
if ('' === $diploma) {
|
||||
$diploma = trim((string) carbon_get_post_meta($tid, 'teacher_education'));
|
||||
}
|
||||
if ('' !== $diploma) {
|
||||
$person['alumniOf'] = array('@type' => 'CollegeOrUniversity', 'name' => $diploma);
|
||||
$person['alumniOf'] = array('@type' => 'CollegeOrUniversity', 'name' => wp_strip_all_tags($diploma));
|
||||
}
|
||||
|
||||
// ── Рейтинг преподавателя ──
|
||||
@ -363,9 +366,77 @@ $sp_avg_num = function_exists('dekart_teacher_review_avg')
|
||||
$sp_avg = $sp_avg_num > 0 ? number_format($sp_avg_num, 1, '.', '') : '';
|
||||
$rating_num = $sp_avg_num > 0 ? $sp_avg_num : ( is_numeric($rating) ? (float) $rating : 0.0 );
|
||||
|
||||
// AggregateRating невалиден для Person
|
||||
// AggregateRating по реальным отзывам (Person)
|
||||
if ($sp_avg_num > 0 && $review_count > 0) {
|
||||
$person['aggregateRating'] = array(
|
||||
'@type' => 'AggregateRating',
|
||||
'ratingValue' => $sp_avg,
|
||||
'ratingCount' => (string) $review_count,
|
||||
'bestRating' => '5',
|
||||
);
|
||||
|
||||
// Review: Person не поддержан Google
|
||||
$teacher_reviews = get_posts(array(
|
||||
'post_type' => 'reviews',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 5,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'fields' => 'ids',
|
||||
'no_found_rows' => true,
|
||||
'meta_query' => array(
|
||||
array( 'key' => '_review_teacher|||0|id', 'value' => (string) $tid, 'compare' => '=' ),
|
||||
),
|
||||
));
|
||||
$review_items = array();
|
||||
foreach ($teacher_reviews as $rid) {
|
||||
$star = (int) carbon_get_post_meta($rid, 'review_star');
|
||||
if ($star < 1 || $star > 5) {
|
||||
continue;
|
||||
}
|
||||
$item = array(
|
||||
'@type' => 'Review',
|
||||
'author' => array( '@type' => 'Person', 'name' => wp_strip_all_tags(get_the_title($rid)) ),
|
||||
'reviewRating' => array( '@type' => 'Rating', 'ratingValue' => (string) $star, 'bestRating' => '5' ),
|
||||
);
|
||||
$rtext = wp_strip_all_tags((string) carbon_get_post_meta($rid, 'review_text'));
|
||||
if ('' !== $rtext) {
|
||||
$item['reviewBody'] = $rtext;
|
||||
}
|
||||
$item['datePublished'] = get_the_date('c', $rid);
|
||||
$review_items[] = $item;
|
||||
}
|
||||
if (! empty($review_items)) {
|
||||
$person['review'] = $review_items;
|
||||
}
|
||||
}
|
||||
|
||||
// E-E-A-T: образование, гео, место работы
|
||||
$edu_text = trim((string) carbon_get_post_meta($tid, 'teacher_education'));
|
||||
if ('' !== $edu_text) {
|
||||
$person['hasCredential'] = array(
|
||||
'@type' => 'EducationalOccupationalCredential',
|
||||
'credentialCategory' => 'Образование',
|
||||
'name' => wp_strip_all_tags($edu_text),
|
||||
);
|
||||
}
|
||||
if (! empty($branch_geo_areas)) {
|
||||
$areas = array_filter(array_map('trim', preg_split('/[,;]+/', (string) $branch_geo_areas)));
|
||||
if (! empty($areas)) {
|
||||
$person['areaServed'] = array_map(function ($c) {
|
||||
return array( '@type' => 'City', 'name' => wp_strip_all_tags($c) );
|
||||
}, array_values($areas));
|
||||
}
|
||||
}
|
||||
$person_addr = array();
|
||||
if (! empty($org_street)) { $person_addr['streetAddress'] = $org_street; }
|
||||
if (! empty($org_city)) { $person_addr['addressLocality'] = $org_city; }
|
||||
if (! empty($org_region)) { $person_addr['addressRegion'] = $org_region; }
|
||||
if (! empty($org_zip)) { $person_addr['postalCode'] = $org_zip; }
|
||||
if (! empty($person_addr)) {
|
||||
$person_addr = array_merge(array('@type' => 'PostalAddress', 'addressCountry' => 'RU'), $person_addr);
|
||||
$person['workLocation'] = array('@type' => 'Place', 'address' => $person_addr);
|
||||
}
|
||||
$person['knowsLanguage'] = 'ru';
|
||||
|
||||
// ── Course (предмет + мини-группа) ──
|
||||
// Person/Org один раз (@id)
|
||||
@ -510,7 +581,7 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($tenure) : ?>
|
||||
<span class="teacher-single__hero-fact">Стаж — <?php echo esc_html($tenure); ?> лет</span>
|
||||
<span class="teacher-single__hero-fact">Стаж — <?php echo esc_html($tenure); ?> <?php echo esc_html(dekart_years_plural((int) $tenure)); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="teacher-single__hero-fact">Мини-группа <?php echo esc_html($group_size); ?> чел.</span>
|
||||
</div>
|
||||
@ -727,9 +798,9 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
|
||||
<article class="teacher-single__course" id="<?php echo esc_attr($course_anchor); ?>">
|
||||
<div class="teacher-single__course-head">
|
||||
<span class="teacher-single__course-ico" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#<?php echo esc_attr($course_icons[$course_i - 1] ?? 'icon-book'); ?>"/></svg></span>
|
||||
<h2 class="teacher-single__course-title">
|
||||
<?php echo esc_html($si['name']); ?> <?php echo esc_html($branch_city_prep); ?>
|
||||
</h2>
|
||||
<h3 class="teacher-single__course-title">
|
||||
<?php echo esc_html($si['name']); ?>
|
||||
</h3>
|
||||
<?php if (! empty($si['url'])) : ?>
|
||||
<a class="teacher-single__course-link" href="<?php echo esc_url($si['url']); ?>">Подробнее о программе →</a>
|
||||
<?php endif; ?>
|
||||
@ -1047,7 +1118,7 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
|
||||
// ─── ЭКСПЕРТНОСТЬ ───
|
||||
$teacher_creds = trim(implode(', ', array_filter(array(
|
||||
$direction ?: '',
|
||||
($tenure ? 'педагогический стаж ' . $tenure . ' лет' : ''),
|
||||
($tenure ? 'педагогический стаж ' . $tenure . ' ' . dekart_years_plural((int) $tenure) : ''),
|
||||
))));
|
||||
get_template_part('template-parts/author-eaat', null, array(
|
||||
'author_name' => $full_name,
|
||||
|
||||
@ -56,7 +56,7 @@ $teachers_query = new WP_Query($query_args);
|
||||
if ($start_year && is_numeric($start_year)) {
|
||||
$e = (int) date('Y') - (int) $start_year;
|
||||
if ($e > 0) {
|
||||
$t_exp = $e . ' лет';
|
||||
$t_exp = $e . ' ' . dekart_years_plural($e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +106,7 @@ $teachers_query = new WP_Query($query_args);
|
||||
</div>
|
||||
<button class="teachers-cards__btn open-bitrix-form">Записаться к этому педагогу</button>
|
||||
</div>
|
||||
<a class="teachers-cards__card-link" href="<?php echo esc_url(get_permalink($t_id)); ?>" aria-label="<?php echo esc_attr('Страница преподавателя: ' . $t_name); ?>"></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user