-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
148 lines (133 loc) · 6.96 KB
/
single.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
require get_template_directory() . '/assets/php/navigations/socials.php';
require get_template_directory() . '/assets/php/navigations/left_navigation.php';
?>
<?php get_header(); ?>
<?php get_template_part('/template-parts/content', 'mobile_bottom')?>
<header class="header-post">
<?php
$locale = get_locale();
$addition_to_link = null;
if($locale !== "ru_RU"){
$addition_to_link = $locale;
} else {
$addition_to_link = '';
}
?>
<span>
<a class="header-post__logo" href="/<?php echo $addition_to_link;?>" aria-label="Перейти на главную страницу">
<?php echo !empty( get_field("kinder-logo-text")) ? get_field("kinder-logo-text") : (get_bloginfo('name') ? get_bloginfo('name') : __("Логотип", "kinder"));?>
</a>
</span>
<div class="header-post__menu">
<nav>
<?php
if( has_nav_menu("top_menu") ){
wp_nav_menu(array(
'theme_location' => 'top_menu',
'container' => false,
'menu_class' => 'header-post__list',
'depth' => 1,
"items_wrap" => '<ul class="%2$s">%3$s</ul>',
'walker' => new Top_Menu()
));
} else {
?>
<ul class="header__list">
<li class="header-post__menu-item"><a aria-label="<?php echo __("Перейти на главную страницу", "kinder") ?>" href="/"><?php echo __("Главная", "kinder") ?></a></li>
<li class="header-post__menu-item"><a aria-label = "<?php echo __("Перейти к всем записям", "kinder") ?>" href="/posts"><?php echo __("Все записи", "kinder") ?></a></li>
</ul>
<?php
}
?>
</nav>
<div class="header-post__icon_wrapper" role="button" aria-label="<?php echo __("включить/выключить режим высокого контраста", "kinder") ?>">
<svg class="header-post__icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path d="M1 12C1 12 5 4 12 4C19 4 23 12 23 12C23 12 19 20 12 20C5 20 1 12 1 12Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path id="cancel" class="header-post__icon_cancel" fill="currentColor" d="M21.7699 2.22988C21.4699 1.92988 20.9799 1.92988 20.6799 2.22988L2.22988 20.6899C1.92988 20.9899 1.92988 21.4799 2.22988 21.7799C2.37988 21.9199 2.56988 21.9999 2.76988 21.9999C2.96988 21.9999 3.15988 21.9199 3.30988 21.7699L21.7699 3.30988C22.0799 3.00988 22.0799 2.52988 21.7699 2.22988Z" />
</svg>
</div>
<?php echo do_shortcode( '[bogo]' ); ?>
</div>
</header>
<div class="banner">
<?php
$fields = get_fields();
$photo_id = (array_key_exists('kinder_single_banner_foto', $fields) && $fields['kinder_single_banner_foto'] !== '') ? $fields['kinder_single_banner_foto'] : null;
$photo_url = null;
if($photo_id){
$photo_url = wp_get_attachment_image_src($photo_id, 'banner_background')[0];
}
$photo_alt = get_post_meta($photo_id, '_wp_attachment_image_alt', TRUE);
?>
<img class="banner__image" src="<?php
echo ($photo_url && $photo_url !== "") ? $photo_url : esc_url( get_template_directory_uri() . BANNER_DEFAULT_ROUTE);
?>" alt="<?php echo ($photo_alt && $photo_alt !== "") ? $photo_alt : "banner";?>"
role="presentation" width="1446" height="314" aria-hidden="true">
<div class="banner__title_wrapper">
<h1 class="banner__title"><?php the_title();?></h1>
</div>
</div>
<div class="main_flow">
<main class="main_flow__main">
<div class="main" >
<div class="main__wrapper">
<?php get_template_part('/template-parts/content', 'breadcrumbs_single')?>
<!-- BREAKER-->
<div style="height: 4px; background-color: var(--grey); margin: 2.5rem 0; border-radius: 2px;">
</div>
<!-- END OF BREAKER-->
<article class="main__content">
<?php the_content(); ?>
<?php
// Get the ID of the current category
$category = get_the_category();
$category_id = $category[0]->cat_ID;
// Query all posts in the same category and language
$post_locale = get_locale();
$args = array(
'category__in' => $category_id,
'post_type' => 'post',
'posts_per_page' => -1,
'lang' => $post_locale
);
$query = new WP_Query($args);
$posts = $query->posts;
/*$posts = get_posts($args);*/
?>
<div class="related_links">
<h4 class="related_links__title"><?php echo __("Также в этом разделе:", "kinder")?></h4>
<div class="related_links__links">
<?php
// Display the links and titles of all posts in the same category
foreach ($posts as $post) {
setup_postdata($post);
?>
<a href="<?php the_permalink(); ?>" class="related_links__link"><?php the_title(); ?></a>
<?php
}
wp_reset_postdata();
?>
</div>
</div>
</article>
</div>
</div>
</main>
<aside class="main_flow__aside">
<nav class="menu" aria-label=<?php echo __("Основное меню", "kinder")?>>
<div class="menu__sticky">
<h3 class="menu__heading"><?php echo __("Навигация", "kinder")?></h3>
<?php get_left_top_menu(); ?>
<?php echo get_left_middle_menu(); ?>
<div class="menu__socials">
<?php echo get_left_socials(); ?>
</div>
</div>
</nav>
</aside>
</div>
<?php
get_footer();
?>