Task 10121 | fix: поправили прайсы цен для карт, которые некорректно выводятся при заполнении из админки

This commit is contained in:
Боевой сайт - fakel
2025-11-21 21:11:51 +03:00
parent 21562852ca
commit 2ac2340779
57 changed files with 7935 additions and 14019 deletions

View File

@@ -3,7 +3,7 @@
* хлебные крошки
*/
// Проверяем, не объявлена ли уже функция
if (!function_exists('generate_yandex_breadcrumbs')) {
function generate_yandex_breadcrumbs()
@@ -107,58 +107,61 @@ if (!function_exists('generate_yandex_breadcrumbs')) {
);
// Кастомные таксономии
} elseif (is_tax()) {
$term = get_queried_object();
$taxonomy = $term->taxonomy;
// Архив типа поста для этой таксономии
$taxonomy_obj = get_taxonomy($taxonomy);
if (!empty($taxonomy_obj->object_type)) {
$post_type = $taxonomy_obj->object_type[0];
$post_type_obj = get_post_type_object($post_type);
if ($post_type_obj && $post_type_obj->has_archive) {
$archive_link = get_post_type_archive_link($post_type);
if ($archive_link) {
$breadcrumbs[] = array(
"@type" => "ListItem",
"position" => $position++,
"name" => $clean_title($post_type_obj->labels->name),
"item" => $archive_link
);
}
}
}
// Родительские термины для иерархических таксономий
if (is_taxonomy_hierarchical($taxonomy)) {
$parent_terms = array();
$parent_id = $term->parent;
while ($parent_id) {
$parent_term = get_term($parent_id, $taxonomy);
array_unshift($parent_terms, $parent_term);
$parent_id = $parent_term->parent;
}
foreach ($parent_terms as $parent_term) {
$breadcrumbs[] = array(
"@type" => "ListItem",
"position" => $position++,
"name" => $clean_title($parent_term->name),
"item" => get_term_link($parent_term)
);
}
}
$breadcrumbs[] = array(
"@type" => "ListItem",
"position" => $position++,
"name" => $clean_title($term->name),
"item" => get_term_link($term)
);
// Отдельные посты
} elseif (is_single()) {
}
// elseif (is_tax()) {
// $term = get_queried_object();
// $taxonomy = $term->taxonomy;
//
// // Архив типа поста для этой таксономии
// $taxonomy_obj = get_taxonomy($taxonomy);
// if (!empty($taxonomy_obj->object_type)) {
// $post_type = $taxonomy_obj->object_type[0];
// $post_type_obj = get_post_type_object($post_type);
//
// if ($post_type_obj && $post_type_obj->has_archive) {
// $archive_link = get_post_type_archive_link($post_type);
// if ($archive_link) {
// $breadcrumbs[] = array(
// "@type" => "ListItem",
// "position" => $position++,
// "name" => $clean_title($post_type_obj->labels->name),
// "item" => $archive_link
// );
// }
// }
// }
//
// // Родительские термины для иерархических таксономий
// if (is_taxonomy_hierarchical($taxonomy)) {
// $parent_terms = array();
// $parent_id = $term->parent;
// while ($parent_id) {
// $parent_term = get_term($parent_id, $taxonomy);
// array_unshift($parent_terms, $parent_term);
// $parent_id = $parent_term->parent;
// }
//
// foreach ($parent_terms as $parent_term) {
// $breadcrumbs[] = array(
// "@type" => "ListItem",
// "position" => $position++,
// "name" => $clean_title($parent_term->name),
// /* "item" => get_term_link($parent_term)*/ // TODO: Ссылки на таксономии отключены
// "item" => $archive_link
// );
// }
// }
//
// $breadcrumbs[] = array(
// "@type" => "ListItem",
// "position" => $position++,
// "name" => $clean_title($term->name),
// "item" => get_term_link($term)
// );
//
// // Отдельные посты
// }
elseif (is_single()) {
global $post;
$post_type = get_post_type($post);
@@ -226,39 +229,40 @@ if (!function_exists('generate_yandex_breadcrumbs')) {
}
}
if ($main_taxonomy) {
$terms = get_the_terms($post, $main_taxonomy);
if (!empty($terms) && !is_wp_error($terms)) {
$main_term = $terms[0];
// Родительские термины для иерархических таксономий
if (is_taxonomy_hierarchical($main_taxonomy)) {
$parent_terms = array();
$parent_id = $main_term->parent;
while ($parent_id) {
$parent_term = get_term($parent_id, $main_taxonomy);
array_unshift($parent_terms, $parent_term);
$parent_id = $parent_term->parent;
}
foreach ($parent_terms as $parent_term) {
$breadcrumbs[] = array(
"@type" => "ListItem",
"position" => $position++,
"name" => $clean_title($parent_term->name),
"item" => get_term_link($parent_term)
);
}
}
$breadcrumbs[] = array(
"@type" => "ListItem",
"position" => $position++,
"name" => $clean_title($main_term->name),
"item" => get_term_link($main_term)
);
}
}
// if ($main_taxonomy) {
// $terms = get_the_terms($post, $main_taxonomy);
// if (!empty($terms) && !is_wp_error($terms)) {
// $main_term = $terms[0];
//
// // Родительские термины для иерархических таксономий
// if (is_taxonomy_hierarchical($main_taxonomy)) {
// $parent_terms = array();
// $parent_id = $main_term->parent;
// while ($parent_id) {
// $parent_term = get_term($parent_id, $main_taxonomy);
// array_unshift($parent_terms, $parent_term);
// $parent_id = $parent_term->parent;
// }
//
// foreach ($parent_terms as $parent_term) {
// $breadcrumbs[] = array(
// "@type" => "ListItem",
// "position" => $position++,
// "name" => $clean_title($parent_term->name),
// /* "item" => get_term_link($parent_term)*/
// "item" => $archive_link
// );
// }
// }
//
// $breadcrumbs[] = array(
// "@type" => "ListItem",
// "position" => $position++,
// "name" => $clean_title($main_term->name),
// "item" => get_term_link($main_term)
// );
// }
// }
}
// Текущий пост