This commit is contained in:
GP_DEV
2025-08-01 10:07:08 +03:00
parent 21562852ca
commit 7d7a28e789
54 changed files with 4554 additions and 6928 deletions

View File

@@ -1,7 +1,4 @@
<?php
/**
* Навигационное меню с SEO
*/
$menu = wp_get_nav_menu_object('Шапка сайта');
@@ -16,7 +13,6 @@ if ($menu) {
$current_region = 'RU';
$navigation_schema = array(
"@context" => "https://schema.org",
"@type" => "SiteNavigationElement",
@@ -38,15 +34,20 @@ if ($menu) {
<p class="screen-reader-text">Главное меню</p>
<ul class="flex items-center h-full gap-[30px] justify-between nav-menu main-menu" role="menubar" aria-label="Главная навигация">
<ul class="max-[1300px]:gap-[16px] max-[1140px]:gap-[8px] max-[1050px]:gap-[16px] flex items-center h-full gap-[30px] justify-between nav-menu main-menu" role="menubar" aria-label="Главная навигация">
<?php
$position = 1;
foreach ($menu_items as $index => $item) {
if ($current_lang === 'gym' && $item->type === 'post_type_archive' && $item->object === 'training') {
continue;
}
if ($item->type === 'taxonomy') {
continue;
}
$url = $item->url;
$title = $clean_title($item->title);
// Polylang обработка
if ($current_lang && $item->object == 'page' && function_exists('pll_get_post')) {
$translated_page_id = pll_get_post($item->object_id, $current_lang);
if ($translated_page_id) {
@@ -58,13 +59,11 @@ if ($menu) {
}
}
// Дата изменения
$last_modified = '';
if ($item->object == 'page') {
$last_modified = get_the_modified_time('c', $item->object_id);
}
// Определение активного пункта
$is_current = false;
$aria_current = '';
@@ -79,7 +78,6 @@ if ($menu) {
}
}
// CSS классы
$css_classes = array(
'menu-item',
'menu-item-' . $item->ID,
@@ -98,7 +96,6 @@ if ($menu) {
$css_classes = array_merge($css_classes, array_filter($item->classes));
}
// Схема навигации
$page_data = array(
"@type" => "WebPage",
"name" => $title,
@@ -130,7 +127,6 @@ if ($menu) {
</li>
<?php
// Сепаратор
if ($index < count($menu_items) - 1): ?>
<li class="menu-separator" role="none" aria-hidden="true">
<span class="separator">
@@ -148,7 +144,6 @@ if ($menu) {
</nav>
<?php
// Только схема навигации
?>
<script type="application/ld+json">
<?php echo json_encode($navigation_schema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>