2026-10-05 GLOBAL

This commit is contained in:
Dekart Deploy Bot 2026-10-06 21:34:34 +00:00
parent 2419314057
commit affe75eb18
9 changed files with 341 additions and 39 deletions

View File

@ -11573,6 +11573,19 @@ main > .pksh-section:first-child {
object-position: center 28%;
display: block;
}
/* Заглушка без фото — нейтральный блок с инициалами */
.teachers-card__photo--empty {
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, color-mix(in oklab, var(--color-primary), transparent 88%), color-mix(in oklab, var(--color-secondary), transparent 84%));
color: var(--color-primary, #2563EB);
font-family: var(--font-display, inherit);
font-weight: 800;
font-size: 2rem;
line-height: 1;
object-fit: unset;
}
/* Бейдж — компактный, визуально лёгкий */
.teachers-card__badge {
position: absolute;
@ -11610,6 +11623,13 @@ main > .pksh-section:first-child {
overflow-wrap: anywhere;
text-wrap: balance;
}
.teachers-card__name a {
color: inherit;
text-decoration: none;
}
.teachers-card__name a:hover {
color: var(--color-primary, #2563EB);
}
/* Специализация — 2-й уровень, максимум 2 строки */
.teachers-card__direction {
font-size: 0.9375rem;
@ -11731,6 +11751,34 @@ main > .pksh-section:first-child {
.teachers-card:hover,
.teachers-card__btn:hover { transform: none; }
}
/* FAQ-блок страниц (шорткод [faq]) */
.page-faq {
padding: 48px 0;
}
.page-faq__list {
display: flex;
flex-direction: column;
gap: 8px;
max-width: 820px;
margin: 0 auto;
}
.page-faq__item {
background: var(--color-bg, #FFFFFF);
border: 1px solid var(--color-border, #E2E8F0);
border-radius: var(--radius-md, 16px);
padding: 4px 18px;
}
.page-faq__q {
cursor: pointer;
font-weight: 700;
padding: 14px 0;
list-style: none;
}
.page-faq__a {
padding: 0 0 14px;
color: var(--color-text-muted, #475569);
line-height: 1.6;
}
.teachers-cards__card {
background: var(--color-bg);
border-radius: var(--pksh-radius-card, 24px);

File diff suppressed because one or more lines are too long

View File

@ -134,6 +134,32 @@
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: clamp(16px, 2vw, 24px);
}
.teachers-trust__profiles {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 8px 14px;
margin-top: clamp(20px, 3vw, 32px);
}
.teachers-trust__profiles-label {
font-size: 0.875rem;
color: var(--color-text-muted, #475569);
}
.teachers-trust__profile {
font-size: 0.875rem;
font-weight: 600;
color: var(--color-primary, #2563EB);
text-decoration: none;
padding: 4px 12px;
border: 1px solid rgba(37, 99, 235, 0.28);
border-radius: var(--radius-pill, 100px);
transition: background .2s, color .2s;
}
.teachers-trust__profile:hover {
background: var(--color-primary, #2563EB);
color: #FFFFFF;
}
.teachers-trust__item {
text-align: center;
padding: var(--space-4, 24px);

File diff suppressed because one or more lines are too long

View File

@ -1556,6 +1556,20 @@ function add_carbon()
Field::make('text', 'teacher_diploma', 'Учебное заведение (для микроразметки alumniOf)')
->set_width(50)
->help_text('Одно главное учебное заведение (напр. «Московский педагогический государственный университет (МПГУ)»). Используется в Schema.org для свойства alumniOf. Если пусто — свойство не выводится.'),
Field::make('text', 'teacher_alumni', 'Вуз для схемы (alumniOf) — чистое название')
->set_width(50)
->help_text('Короткое название вуза без абзацев: «МПГУ». Приоритетно для alumniOf. Пусто — берётся поле «Учебное заведение» выше.'),
Field::make('text', 'teacher_credential', 'Квалификация для схемы (hasCredential)')
->set_width(50)
->help_text('Кратко: «Учитель начальных классов». Пусто — первая строка «Образование».'),
Field::make('text', 'teacher_languages', 'Языки преподавания (через запятую)')
->set_width(50)
->help_text('Пример: «ru, en». Для Schema.org knowsLanguage. Пусто — ru.'),
Field::make('complex', 'teacher_sameas', 'Внешние профили (sameAs)')
->add_fields(array(
Field::make('text', 'url', 'URL профиля')->set_width(100),
))
->set_help_text('Ссылки на профили преподавателя (Яндекс Бизнес, 2ГИС, VK и т.п.) для Person.sameAs.'),
Field::make('text', 'teacher_video', 'Ссылка на видеопрезентацию')
->set_width(100)
->help_text('Укажите ссылку на видео в youtube. Пример: <iframe src="https://vk.com/video_ext.php?oid=-43228812&id=456240170hd=2" width="853" height="480" allow="autoplay; encrypted-media; fullscreen; picture-in-picture;" frameborder="0" allowfullscreen></iframe>'),
@ -3243,6 +3257,121 @@ function sc_teachers($atts, $content = null)
return ob_get_clean();
}
// ─── Аналитика: ID счётчика Метрики (константа или из сниппета) ───
function dekart_metrika_id(): string
{
if (defined('YM_COUNTER_ID')) {
return (string) YM_COUNTER_ID;
}
$snippet = (string) get_option('dekart_counter_yandex', '');
if (preg_match('/ym\(\s*(\d{5,})/', $snippet, $m)) {
return $m[1];
}
return '';
}
// Цели Метрики/GA для CTA [data-goal] и отправки форм
add_action('wp_footer', function () {
$ym_id = dekart_metrika_id();
?>
<script>
(function(){
var YM = <?php echo wp_json_encode($ym_id); ?>;
function goal(name){
if(!name){return;}
if (typeof gtag === 'function') { gtag('event', name); }
if (YM && typeof ym === 'function') { ym(YM, 'reachGoal', name); }
}
document.addEventListener('click', function(e){
var el = e.target.closest ? e.target.closest('[data-goal]') : null;
if (el) { goal(el.getAttribute('data-goal')); }
}, true);
document.addEventListener('submit', function(e){
var f = e.target;
if (f && f.closest && (f.closest('.b24-form') || f.closest('form'))) {
goal(f.getAttribute('data-goal') || 'form_submit');
}
}, true);
})();
</script>
<?php
}, 99);
// ─── 301: старые слаги преподавателей (_wp_old_slug) ───
add_action('template_redirect', function () {
if (! is_404()) {
return;
}
$path = trim((string) wp_parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH), '/');
if ('' === $path) {
return;
}
$slug = basename($path);
$found = get_posts(array(
'post_type' => 'teacher',
'post_status' => 'publish',
'posts_per_page' => 1,
'fields' => 'ids',
'no_found_rows' => true,
'meta_query' => array(
array( 'key' => '_wp_old_slug', 'value' => $slug, 'compare' => '=' ),
),
));
if (! empty($found)) {
wp_safe_redirect(get_permalink((int) $found[0]), 301);
exit;
}
});
// ─── Shortcode [faq]...[/faq] — видимый FAQ + JSON-LD FAQPage ───
add_shortcode('faq', function ($atts, $content = null) {
$content = (string) $content;
if ('' === trim($content)) {
return '';
}
$items = array();
foreach (preg_split('/\r\n|\r|\n/', $content) as $line) {
$line = trim($line);
if ('' === $line) {
continue;
}
$parts = preg_split('/\s*::\s*/', $line, 2);
if (count($parts) < 2) {
$parts = preg_split('/\s*\|\s*/', $line, 2);
}
if (count($parts) < 2) {
continue;
}
$q = trim($parts[0]);
$a = trim($parts[1]);
if ('' !== $q && '' !== $a) {
$items[] = array( 'q' => $q, 'a' => $a );
}
}
if (empty($items)) {
return '';
}
$out = '<section class="page-faq"><div class="container"><div class="page-faq__list">';
foreach ($items as $it) {
$out .= '<details class="page-faq__item"><summary class="page-faq__q">' . esc_html($it['q']) . '</summary><div class="page-faq__a">' . wp_kses_post($it['a']) . '</div></details>';
}
$out .= '</div>';
$entity = array();
foreach ($items as $it) {
$entity[] = array(
'@type' => 'Question',
'name' => wp_strip_all_tags($it['q']),
'acceptedAnswer' => array( '@type' => 'Answer', 'text' => wp_strip_all_tags($it['a']) ),
);
}
$out .= '<script type="application/ld+json">' . wp_json_encode(
array( '@context' => 'https://schema.org', '@type' => 'FAQPage', 'mainEntity' => $entity ),
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG
) . '</script>';
$out .= '</div></section>';
return $out;
});
/**
* Карта «преподаватель → ID опубликованных отзывов» (один запрос на страницу).
* Единый источник отзывов педагога: CF association review_teacher и легаси prepodavatel.

View File

@ -745,6 +745,20 @@ function dekart_schema_local_business(): ?array
}
}
$gis_url = get_option('branch_ext_2gis', '');
if (! empty($gis_url) && filter_var($gis_url, FILTER_VALIDATE_URL)) {
$found_gis = false;
foreach ($same_as as $existing) {
if (false !== stripos($existing, parse_url($gis_url, PHP_URL_HOST))) {
$found_gis = true;
break;
}
}
if (! $found_gis) {
$same_as[] = esc_url($gis_url);
}
}
if (! empty($same_as)) {
$lb['sameAs'] = $same_as;
}

View File

@ -268,6 +268,27 @@ if (! empty($org_license)) {
);
}
// Внешние профили организации (Яндекс Бизнес, 2ГИС, Google, соцсети)
$org_sameas = array();
foreach (array(
get_option('branch_yandex_business_url'),
get_option('branch_ext_2gis'),
get_option('branch_google_business_url'),
) as $su) {
if (! empty($su) && filter_var($su, FILTER_VALIDATE_URL)) {
$org_sameas[] = esc_url($su);
}
}
foreach ((array) get_option('branch_social', array()) as $se) {
$su = trim((string) ( $se['url'] ?? '' ));
if ('' !== $su && filter_var($su, FILTER_VALIDATE_URL)) {
$org_sameas[] = esc_url($su);
}
}
if (! empty($org_sameas)) {
$org['sameAs'] = array_values(array_unique($org_sameas));
}
// ── Person (преподаватель) ──
// Каталог программ филиала
$branch_programs_by_name = array();
@ -359,12 +380,13 @@ if ($about_text) {
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'));
$alumni_name = trim((string) carbon_get_post_meta($tid, 'teacher_alumni'));
if ('' === $alumni_name) {
$alumni_name = trim((string) carbon_get_post_meta($tid, 'teacher_diploma'));
}
if ('' !== $diploma) {
$person['alumniOf'] = array('@type' => 'CollegeOrUniversity', 'name' => wp_strip_all_tags($diploma));
$alumni_name = trim((string) ( preg_split('/[\r\n]+/', $alumni_name)[0] ?? '' ));
if ('' !== $alumni_name) {
$person['alumniOf'] = array('@type' => 'CollegeOrUniversity', 'name' => wp_strip_all_tags($alumni_name));
}
// ── Рейтинг преподавателя ──
@ -376,12 +398,16 @@ $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 );
// E-E-A-T: образование, гео, место работы
$edu_text = trim((string) carbon_get_post_meta($tid, 'teacher_education'));
if ('' !== $edu_text) {
$cred_name = trim((string) carbon_get_post_meta($tid, 'teacher_credential'));
if ('' === $cred_name) {
$cred_name = trim((string) carbon_get_post_meta($tid, 'teacher_education'));
}
$cred_name = trim((string) ( preg_split('/[\r\n]+/', $cred_name)[0] ?? '' ));
if ('' !== $cred_name) {
$person['hasCredential'] = array(
'@type' => 'EducationalOccupationalCredential',
'credentialCategory' => 'Образование',
'name' => wp_strip_all_tags($edu_text),
'name' => mb_substr(wp_strip_all_tags($cred_name), 0, 160),
);
}
if (! empty($branch_geo_areas)) {
@ -401,7 +427,25 @@ 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';
$lang_raw = trim((string) carbon_get_post_meta($tid, 'teacher_languages'));
if ('' !== $lang_raw) {
$langs = array_values(array_filter(array_map('trim', preg_split('/[,;]+/', $lang_raw))));
$person['knowsLanguage'] = count($langs) > 1 ? $langs : $langs[0];
} else {
$person['knowsLanguage'] = 'ru';
}
// Внешние профили преподавателя
$person_sameas = array();
foreach ((array) carbon_get_post_meta($tid, 'teacher_sameas') as $ps) {
$ps_url = trim((string) ( $ps['url'] ?? '' ));
if ('' !== $ps_url && filter_var($ps_url, FILTER_VALIDATE_URL)) {
$person_sameas[] = esc_url($ps_url);
}
}
if (! empty($person_sameas)) {
$person['sameAs'] = array_values(array_unique($person_sameas));
}
// ── Course (предмет + мини-группа) ──
// Person/Org один раз (@id)
@ -452,7 +496,7 @@ if (! empty($subject_items)) {
$courses[] = $build_course($item['name'], $ci, $availability, '', $item['price']);
}
} else {
$courses[] = $build_course( ( $subj ? $subj : 'Обучение' ) . ' — мини-группы ' . $group_size . ' чел.', 1 );
$courses[] = $build_course('Занятия в мини-группе ' . $group_size . ' чел.', 1);
}
// ── Рейтинг и отзывы — на Course (Person не поддержан Google) ──
@ -586,7 +630,7 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
<?php endif; ?>
<div class="teacher-single__hero-cta">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form" data-goal="teacher_form">
<?php echo esc_html($cta_primary); ?>
</button>
<?php if ($sched_url) : ?>
@ -598,7 +642,7 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
<p class="teacher-single__risk-note"><?php echo esc_html($risk_note); ?></p>
<?php if ($branch_phone && $phone_clean) : ?>
<noscript>
<p class="ds-hero__cta-fallback">Позвоните: <a href="tel:<?php echo esc_attr($phone_clean); ?>"><?php echo esc_html($branch_phone); ?></a></p>
<p class="ds-hero__cta-fallback">Позвоните: <a href="tel:<?php echo esc_attr($phone_clean); ?>" data-goal="teacher_phone"><?php echo esc_html($branch_phone); ?></a></p>
</noscript>
<?php endif; ?>
</div>
@ -811,7 +855,7 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
</ul>
<?php endif; ?>
<div class="teacher-single__course-foot">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form" data-goal="teacher_form">
<?php echo esc_html($cta_primary); ?>
</button>
</div>
@ -896,7 +940,7 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
<summary class="teacher-single__spoiler-summary"><?php echo esc_html($segment_4_title); ?></summary>
<div class="teacher-single__spoiler-body">
<p><?php echo esc_html($segment_4_text); ?></p>
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form" data-goal="teacher_form">
<?php echo esc_html($cta_primary); ?>
</button>
</div>
@ -911,7 +955,7 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
<section class="teacher-single__results section-bg reveal" data-bg="teacher-results" aria-labelledby="teacher-results-title">
<div class="container">
<div class="section-header--left">
<h2 id="teacher-results-title" class="bento-h2">Измеримые результаты учеников</h2>
<h2 id="teacher-results-title" class="bento-h2">Динамика результатов учеников</h2>
<p class="bento-p">Не обещания, а факты — что меняется в знаниях и успеваемости после занятий.</p>
</div>
<div class="teacher-single__results-grid">
@ -957,24 +1001,18 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
?>
<section class="teacher-single__cases section-bg reveal" data-bg="teacher-cases" aria-labelledby="teacher-cases-title">
<div class="container">
<h2 id="teacher-cases-title" class="bento-h2">Результаты учеников</h2>
<h2 id="teacher-cases-title" class="bento-h2">Кейсы по предметам</h2>
<div class="teacher-single__cases-tabs" role="tablist" aria-label="Класс">
<?php foreach ($case_tabs as $ci => $tab) :
$tab_id = sanitize_title($tab) . '-' . $ci;
if ('' === trim($tab_id, '-')) {
$tab_id = 'tab-' . $ci;
}
$tab_id = 'c' . (int) $ci;
?>
<button type="button" role="tab" id="case-tab-<?php echo esc_attr($tab_id); ?>" aria-controls="case-panel-<?php echo esc_attr($tab_id); ?>" aria-selected="<?php echo 0 === $ci ? 'true' : 'false'; ?>" class="teacher-single__case-tab<?php echo 0 === $ci ? ' is-active' : ''; ?>" data-case-tab="<?php echo esc_attr($tab); ?>">
<?php echo esc_html($tab); ?> класс
<?php echo esc_html($tab); ?>
</button>
<?php endforeach; ?>
</div>
<?php foreach ($case_tabs as $ci => $tab) :
$tab_id = sanitize_title($tab) . '-' . $ci;
if ('' === trim($tab_id, '-')) {
$tab_id = 'tab-' . $ci;
}
$tab_id = 'c' . (int) $ci;
?>
<div role="tabpanel" id="case-panel-<?php echo esc_attr($tab_id); ?>" aria-labelledby="case-tab-<?php echo esc_attr($tab_id); ?>" class="teacher-single__case-panel<?php echo 0 === $ci ? ' is-active' : ''; ?>" data-case-panel="<?php echo esc_attr($tab); ?>">
<div class="teacher-single__cases-grid">
@ -1095,11 +1133,11 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
<h2 id="teacher-final-title" class="bento-h2">Запишитесь на бесплатную диагностику</h2>
<p class="teacher-single__final-text">Познакомимся, проверим уровень ребёнка и подберём мини-группу <?php echo esc_html($group_size); ?> человек. Перезвоним за 15 минут.</p>
<div class="teacher-single__hero-cta">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form" data-goal="teacher_form">
<?php echo esc_html($cta_primary); ?>
</button>
<?php if ($branch_phone) : ?>
<a class="teacher-single__btn teacher-single__btn--ghost" href="tel:<?php echo esc_attr($phone_clean); ?>">
<a class="teacher-single__btn teacher-single__btn--ghost" href="tel:<?php echo esc_attr($phone_clean); ?>" data-goal="teacher_phone">
<?php echo esc_html($branch_phone); ?>
</a>
<?php endif; ?>
@ -1129,16 +1167,16 @@ $schema_graph[] = array('@type' => 'BreadcrumbList', 'itemListElement' => $bread
?>
<div class="teacher-single__sticky" hidden>
<div class="teacher-single__sticky-inner">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form">
<button type="button" class="teacher-single__btn teacher-single__btn--primary btn-write open-bitrix-form" data-goal="teacher_form">
<?php echo esc_html($cta_primary); ?>
</button>
<?php if ($wa_url) : ?>
<a class="teacher-single__sticky-icon" href="<?php echo esc_url($wa_url); ?>" target="_blank" rel="noopener nofollow" aria-label="Написать в WhatsApp">
<a class="teacher-single__sticky-icon" href="<?php echo esc_url($wa_url); ?>" target="_blank" rel="noopener nofollow" aria-label="Написать в WhatsApp" data-goal="teacher_whatsapp">
<svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2a10 10 0 0 0-8.6 15L2 22l5.2-1.4A10 10 0 1 0 12 2Zm0 18.2a8.2 8.2 0 0 1-4.2-1.2l-.3-.2-3.1.8.8-3-.2-.3a8.2 8.2 0 1 1 7 3.9Zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8-.2-.1-.4-.1-.6.1-.2.3-.6.8-.8 1-.1.2-.3.2-.5.1a6.7 6.7 0 0 1-3.4-3c-.3-.4 0-.5.2-.7l.4-.5c.1-.2.1-.3 0-.5l-.8-1.9c-.2-.5-.4-.4-.6-.4h-.5c-.2 0-.5.1-.7.3-.2.3-.9.9-.9 2.2s.9 2.5 1.1 2.7c.1.2 1.8 2.8 4.4 3.9 2.6 1.1 2.6.7 3.1.7.5 0 1.5-.6 1.7-1.2.2-.6.2-1.1.1-1.2 0-.1-.2-.2-.4-.3Z"/></svg>
</a>
<?php endif; ?>
<?php if ($phone_clean) : ?>
<a class="teacher-single__sticky-icon" href="tel:<?php echo esc_attr($phone_clean); ?>" aria-label="Позвонить">
<a class="teacher-single__sticky-icon" href="tel:<?php echo esc_attr($phone_clean); ?>" aria-label="Позвонить" data-goal="teacher_phone">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 2 .7 2.9a2 2 0 0 1-.5 2.1L8 10a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.5c.9.3 1.9.6 2.9.7a2 2 0 0 1 1.7 2Z"/></svg>
</a>
<?php endif; ?>

View File

@ -13,8 +13,10 @@ if (! $tid) {
$teacher_review_counts = function_exists('dekart_teacher_review_counts') ? dekart_teacher_review_counts() : array();
$current_year = (int) current_time('Y');
$city = get_option('branch_city') ?: carbon_get_theme_option('site_city');
$full_name = get_the_title($tid);
$permalink = get_permalink($tid);
$cat = carbon_get_post_meta($tid, 'teacher_category');
$direction = carbon_get_post_meta($tid, 'teacher_direction');
$badge = carbon_get_post_meta($tid, 'teacher_badge');
@ -22,7 +24,6 @@ $start_year = carbon_get_post_meta($tid, 'teacher_start_year');
$rating = carbon_get_post_meta($tid, 'teacher_rating');
$avatar_id = carbon_get_post_meta($tid, 'teacher_avatar');
$avatar_url = $avatar_id ? wp_get_attachment_url($avatar_id) : '';
$alt_text = $avatar_id ? get_post_meta($avatar_id, '_wp_attachment_image_alt', true) : $full_name;
$tenure = '';
if ($start_year && absint($start_year) > 1900) {
@ -33,6 +34,9 @@ $t_desc = trim((string) carbon_get_post_meta($tid, 'teacher_description'));
$rating_num = (float) $rating;
$teacher_rc = isset($teacher_review_counts[ $tid ]) ? (int) $teacher_review_counts[ $tid ] : 0;
// alt: ФИО + предмет + город
$alt_photo = implode(', ', array_filter(array( $full_name, $direction, $city )));
$rc_word = '';
if ($teacher_rc > 0) {
$rc_mod10 = $teacher_rc % 10;
@ -46,6 +50,12 @@ if ($teacher_rc > 0) {
}
}
// Анкор ссылки: предмет + город
$link_anchor = trim((string) $direction . ( $city ? ' в ' . $city : '' ));
if ('' === $link_anchor) {
$link_anchor = 'Подробнее о преподавателе';
}
$cat_filter = ! empty($cat) ? $cat : 'all';
?>
<article class="teachers-card reveal" data-category="<?php echo esc_attr($cat_filter); ?>">
@ -53,8 +63,16 @@ $cat_filter = ! empty($cat) ? $cat : 'all';
<?php if ($avatar_url) : ?>
<img class="teachers-card__photo" loading="lazy" decoding="async"
src="<?php echo esc_url($avatar_url); ?>"
alt="<?php echo esc_attr($alt_text); ?>"
alt="<?php echo esc_attr($alt_photo); ?>"
width="480" height="384">
<?php else : ?>
<?php
$initials = '';
foreach (array_slice(preg_split('/\s+/u', trim($full_name)), 0, 2) as $np) {
$initials .= mb_substr((string) $np, 0, 1);
}
?>
<div class="teachers-card__photo teachers-card__photo--empty" aria-hidden="true"><?php echo esc_html(mb_strtoupper($initials)); ?></div>
<?php endif; ?>
<?php if ($badge) : ?>
<span class="teachers-card__badge"><?php echo esc_html($badge); ?></span>
@ -62,7 +80,7 @@ $cat_filter = ! empty($cat) ? $cat : 'all';
</div>
<div class="teachers-card__body">
<h3 class="teachers-card__name"><?php echo esc_html($full_name); ?></h3>
<h3 class="teachers-card__name"><a href="<?php echo esc_url($permalink); ?>"><?php echo esc_html($full_name); ?></a></h3>
<?php if ($direction) : ?>
<div class="teachers-card__direction"><?php echo esc_html($direction); ?></div>
@ -90,7 +108,7 @@ $cat_filter = ! empty($cat) ? $cat : 'all';
<?php endif; ?>
<?php if ($teacher_rc > 0) : ?>
<a class="teachers-card__reviews" href="<?php echo esc_url(get_permalink($tid)); ?>">
<a class="teachers-card__reviews" href="<?php echo esc_url($permalink); ?>">
<?php echo esc_html($teacher_rc . ' ' . $rc_word); ?>
</a>
<?php endif; ?>
@ -98,11 +116,11 @@ $cat_filter = ! empty($cat) ? $cat : 'all';
<?php endif; ?>
<div class="teachers-card__actions">
<a class="teachers-card__btn btn-write open-bitrix-form" href="#" onclick="return false;">
<a class="teachers-card__btn btn-write open-bitrix-form" href="#" onclick="return false;" data-goal="teacher_card_form">
Записаться к преподавателю
</a>
<a class="teachers-card__link" href="<?php echo esc_url(get_permalink($tid)); ?>">
Подробнее о преподавателе →
<a class="teachers-card__link" href="<?php echo esc_url($permalink); ?>">
<?php echo esc_html($link_anchor); ?> →
</a>
</div>
</div>

View File

@ -26,6 +26,27 @@ foreach ($trust as $t) {
if (empty($trust_items)) {
return;
}
// Внешние площадки школы
$trust_links = array();
$trust_map = array(
'Яндекс Бизнес' => get_option('branch_yandex_business_url'),
'2ГИС' => get_option('branch_ext_2gis'),
'Google' => get_option('branch_google_business_url'),
'VK' => '',
);
foreach ((array) get_option('branch_social', array()) as $s) {
$sn = mb_strtolower(trim((string) ( $s['name'] ?? '' )));
$su = trim((string) ( $s['url'] ?? '' ));
if ('' !== $su && ( false !== mb_strpos($sn, 'vk') || false !== mb_strpos($sn, 'вк') || false !== mb_strpos($sn, 'вконтакте') )) {
$trust_map['VK'] = $su;
}
}
foreach ($trust_map as $t_label => $t_url) {
if (! empty($t_url) && filter_var($t_url, FILTER_VALIDATE_URL)) {
$trust_links[ $t_label ] = $t_url;
}
}
?>
<section class="teachers-trust section-bg reveal" data-bg="teachers-trust" aria-label="Цифры о преподавателях">
<div class="container">
@ -37,5 +58,13 @@ if (empty($trust_items)) {
</div>
<?php endforeach; ?>
</div>
<?php if (! empty($trust_links)) : ?>
<div class="teachers-trust__profiles">
<span class="teachers-trust__profiles-label">Мы на площадках:</span>
<?php foreach ($trust_links as $t_label => $t_url) : ?>
<a class="teachers-trust__profile" href="<?php echo esc_url($t_url); ?>" target="_blank" rel="noopener nofollow"><?php echo esc_html($t_label); ?></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</section>