forked from italia/design-scuole-wordpress-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
executable file
·422 lines (393 loc) · 28.5 KB
/
header.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package Design_Scuole_Italia
*/
/** Header_Mobile_Menu class */
require_once get_template_directory() . '/walkers/mobile-header-walker.php';
$theme_locations = get_nav_menu_locations();
?>
<!doctype html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php
$active_page = dsi_get_current_group();
get_template_part("template-parts/common/svg");
?>
<!-- Right menu element-->
<nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-right perfect-scrollbar">
<div class="menu-user-mobile menu-user-blue">
</div>
</nav>
<!-- End Right menu element-->
<?php
if(is_search() || is_archive())
get_template_part("template-parts/header/search-filters");
?>
<?php $active_page = dsi_get_current_group(); ?>
<div id="main-wrapper" class="push_container" id="page_top">
<?php get_template_part("template-parts/common/skiplink"); ?>
<header id="main-header" class="bg-white">
<?php get_template_part("template-parts/header/slimheader"); ?>
<div class="container header-top">
<div class="row variable-gutters">
<div class="col-8 d-flex align-items-center">
<button class="hamburger hamburger--spin-r toggle-menu menu-left push-body d-xl-none" type="button" aria-label="apri chiudi navigazione">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
<!-- Left menu element-->
<div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left perfect-scrollbar">
<div class="logo-header">
<?php get_template_part("template-parts/common/logo"); ?>
<div class="h1">
<a href="<?php echo home_url(); ?>">
<span><?php echo dsi_get_option("tipologia_scuola"); ?></span>
<span><strong><?php echo dsi_get_option("nome_scuola"); ?></strong></span>
<span class="d-none d-lg-block"><?php echo dsi_get_option("luogo_scuola"); ?></span>
</a>
</div>
</div><!-- /logo-header -->
<div class="nav-list-mobile dl-menuwrapper">
<nav aria-label="Principale">
<ul class="dl-menu nav-list nav-list-primary" data-element="menu">
<?php
// check if scuola has menu
$theme_location = "menu-scuola";
$option_location = "item_menu_scuola";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/la-scuola.php");
if($landing_url)
$items_wrap = '<ul aria-labelledby="mainNavDropdown1" data-element="school-submenu" class="%2$s"><li class="menu-title" ><div class="h3"><a href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul aria-labelledby="mainNavDropdown1" data-element="school-submenu" class="%2$s">%3$s</ul>';
?>
<li class="text-redbrown menu-dropdown-simple-wrapper">
<a class="toggle-dropdown toggle-dropdown-simple <?php echo $active_page == 'school' ? 'active' : ''?>" role="button" href="#" aria-expanded="false" id="mainNavDropdown1" title="Vai alla pagina: <?php _e("Scuola","design_scuole_italia"); ?>"><?php _e("Scuola","design_scuole_italia"); ?></a>
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "menu-dropdown dl-submenu menu-dropdown-simple",
"container" => "",
"walker" => new Mobile_Header_Menu_Walker()
)) ?>
</li>
<?php
}
?>
<?php
// check if servizi has menu
$theme_location = "menu-servizi";
$option_location = "item_menu_servizi";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/servizi.php");
if($landing_url)
$items_wrap = '<ul aria-labelledby="mainNavDropdown2" id="%1$s" class="%2$s"><li class="menu-title" ><div class="h3"><a href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul aria-labelledby="mainNavDropdown2" id="%1$s" class="%2$s">%3$s</ul>';
?>
<li class="text-purplelight menu-dropdown-simple-wrapper">
<a class="toggle-dropdown toggle-dropdown-simple <?php echo $active_page == 'service' ? 'active' : ''?>" role="button" href="#" aria-expanded="false" id="mainNavDropdown2" title="Vai alla pagina: <?php _e("Servizi","design_scuole_italia"); ?>"><?php _e("Servizi","design_scuole_italia"); ?></a>
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "menu-dropdown dl-submenu menu-dropdown-simple",
"container" => "",
"walker" => new Mobile_Header_Menu_Walker()
)) ?>
</li>
<?php
}
?>
<?php
// check if notizie has menu
$theme_location = "menu-notizie";
$option_location = "item_menu_notizie";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/notizie.php");
if($landing_url)
$items_wrap = '<ul aria-labelledby="mainNavDropdown3" id="%1$s" class="%2$s"><li class="menu-title" ><div class="h3"><a href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul aria-labelledby="mainNavDropdown3" id="%1$s" class="%2$s">%3$s</ul>';
?>
<li class="text-greendark menu-dropdown-simple-wrapper">
<a class="toggle-dropdown toggle-dropdown-simple <?php echo $active_page == 'news' ? 'active' : ''?>" role="button" href="#" aria-expanded="false" id="mainNavDropdown3" title="Vai alla pagina: <?php _e("Novità","design_scuole_italia"); ?>"><?php _e("Novità","design_scuole_italia"); ?></a>
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "menu-dropdown dl-submenu menu-dropdown-simple",
"container" => "",
"walker" => new Mobile_Header_Menu_Walker()
)) ?>
</li>
<?php
}
?>
<?php
// check if didattica has menu
$theme_location = "menu-didattica";
$option_location = "item_menu_didattica";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/didattica.php");
if($landing_url)
$items_wrap = '<ul aria-labelledby="mainNavDropdown4" id="%1$s" class="%2$s"><li class="menu-title" ><div class="h3"><a href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul aria-labelledby="mainNavDropdown4" id="%1$s" class="%2$s">%3$s</ul>';
?>
<li class="text-bluelectric menu-dropdown-simple-wrapper">
<a class="toggle-dropdown toggle-dropdown-simple <?php echo $active_page == 'education' ? 'active' : ''?>" role="button" href="#" aria-expanded="false" id="mainNavDropdown4" title="Vai alla pagina: <?php _e("Didattica","design_scuole_italia"); ?>"><?php _e("Didattica","design_scuole_italia"); ?></a>
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "menu-dropdown dl-submenu menu-dropdown-simple",
"container" => "",
"walker" => new Mobile_Header_Menu_Walker()
)) ?>
</li>
<?php
}
?>
</ul><!-- /nav-list -->
</nav>
<?php
$location = "menu-topright";
if ( has_nav_menu( $location ) ) {
echo '<nav aria-label="Argomenti">';
wp_nav_menu(array("theme_location" => $location, "depth" => 1, "menu_class" => "nav-list nav-list-secondary", "container" => ""));
echo '</nav>';
}
?>
</div>
</div>
<!-- End Left menu element-->
<div class="logo-header">
<?php get_template_part("template-parts/common/logo"); ?>
<div class="h1">
<a href="<?php echo home_url(); ?>" aria-label="Vai alla homepage" title="vai alla homepage" >
<span><?php echo dsi_get_option("tipologia_scuola"); ?></span>
<span><strong><?php echo dsi_get_option("nome_scuola"); ?></strong></span>
<span class="d-none d-lg-block"><?php echo dsi_get_option("luogo_scuola"); ?></span>
</a>
</div>
</div><!-- /logo-header -->
<div class="sticky-main-nav">
</div><!-- /sticky-main-nav -->
</div><!-- /col -->
<div class="col-4 d-flex align-items-center justify-content-end">
<div class="header-search d-flex align-items-center">
<button type="button" class="d-flex align-items-center search-btn" data-toggle="modal" data-target="#search-modal" aria-label="Cerca nel sito" data-element="search-modal-button">
<span class="d-none d-lg-block mr-2"><strong>Cerca</strong></span>
<svg class="svg-search">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-search"></use>
</svg>
</button>
</div><!-- /header-search -->
<div class="header-utils-sticky">
</div>
<?php
/*
if(!is_user_logged_in()) {
get_template_part("template-parts/header/header-anon");
}else{
get_template_part("template-parts/header/header-logged");
}
*/
?>
<?php
$show_socials = dsi_get_option( "show_socials", "socials" );
if($show_socials == "true") : ?>
<div class="header-social">
<span>Seguici su:</span>
<div class="header-social-wrapper">
<?php if($facebook = dsi_get_option( "facebook", "socials" )) :?><a href="<?php echo $facebook; ?>" aria-label="facebook" title="vai alla pagina facebook"><svg class="icon it-social-facebook"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#it-social-facebook"></use></svg></a><?php endif; ?>
<?php if($youtube = dsi_get_option( "youtube", "socials" )) :?><a href="<?php echo $youtube; ?>" aria-label="youtube" title="vai alla pagina youtube"><svg class="icon it-social-youtube"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#it-social-youtube"></use></svg></a><?php endif; ?>
<?php if($instagram = dsi_get_option( "instagram", "socials" )) :?><a href="<?php echo $instagram; ?>" aria-label="instagram" title="vai alla pagina instagram"><svg class="icon it-social-instagram"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#it-social-instagram"></use></svg></a><?php endif; ?>
<?php if($twitter = dsi_get_option( "twitter", "socials" )) :?><a href="<?php echo $twitter; ?>" aria-label="twitter" title="vai alla pagina twitter"><svg class="icon it-social-twitter"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#it-social-twitter"></use></svg></a><?php endif; ?>
<?php if($linkedin = dsi_get_option( "linkedin", "socials" )) :?><a href="<?php echo $linkedin; ?>" aria-label="linkedin" title="vai alla pagina linkedin"><svg class="icon it-social-linkedin"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#it-social-linkedin"></use></svg></a><?php endif; ?>
</div><!-- /header-social-wrapper -->
</div><!-- /header-social -->
<?php endif ?>
</div><!-- /col -->
</div><!-- /row -->
</div><!-- /container -->
<div class="bg-white d-none d-xl-block header-bottom" id="sub-nav">
<div class="container">
<div class="row variable-gutters">
<div class="col nav-container">
<nav aria-label="Principale" class="main-nav" id="menu-principale">
<ul class="dl-menu nav-list nav-list-primary" data-element="menu">
<?php
// check if scuola has menu
$theme_location = "menu-scuola";
$option_location = "item_menu_scuola";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/la-scuola.php");
if($landing_url)
$items_wrap = '<ul class="%2$s" data-element="school-submenu"><li class="menu-title" ><div class="h3"><a class="list-item" href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul class="%2$s" data-element="school-submenu">%3$s</ul>';
?>
<li class="text-redbrown menu-dropdown-simple-wrapper">
<a class="nav-link dropdown-toggle <?php echo $active_page == 'school' ? 'active' : ''?>" data-toggle="dropdown" role="button" href="#" aria-expanded="false" id="mainNavDropdown1"><?php _e("Scuola","design_scuole_italia"); ?></a>
<div class="dropdown-menu menu-dropdown dl-submenu menu-dropdown-simple" aria-labelledby="mainNavDropdown1">
<div class="link-list-wrapper">
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "link-list",
"container" => "",
"walker" => new Header_Menu_Walker()
)) ?>
</div>
</div>
</li>
<?php
}
?>
<?php
// check if servizi has menu
$theme_location = "menu-servizi";
$option_location = "item_menu_servizi";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/servizi.php");
if($landing_url)
$items_wrap = '<ul class="%2$s"><li class="menu-title" ><div class="h3"><a class="list-item" href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul class="%2$s">%3$s</ul>';
?>
<li class="text-purplelight menu-dropdown-simple-wrapper">
<a class="nav-link dropdown-toggle <?php echo $active_page == 'service' ? 'active' : ''?>" data-toggle="dropdown" role="button" href="#" aria-expanded="false" id="mainNavDropdown2"><?php _e("Servizi","design_scuole_italia"); ?></a>
<div class="dropdown-menu menu-dropdown dl-submenu menu-dropdown-simple" aria-labelledby="mainNavDropdown2">
<div class="link-list-wrapper">
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "link-list",
"container" => "",
"walker" => new Header_Menu_Walker()
)) ?>
</div>
</div>
</li>
<?php
}
?>
<?php
// check if notizie has menu
$theme_location = "menu-notizie";
$option_location = "item_menu_notizie";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/notizie.php");
if($landing_url)
$items_wrap = '<ul class="%2$s"><li class="menu-title" ><div class="h3"><a class="list-item" href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul class="%2$s">%3$s</ul>';
?>
<li class="text-greendark menu-dropdown-simple-wrapper">
<a class="nav-link dropdown-toggle <?php echo $active_page == 'news' ? 'active' : ''?>" data-toggle="dropdown" role="button" href="#" aria-expanded="false" id="mainNavDropdown3"><?php _e("Novità","design_scuole_italia"); ?></a>
<div class="dropdown-menu menu-dropdown dl-submenu menu-dropdown-simple" aria-labelledby="mainNavDropdown3">
<div class="link-list-wrapper">
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "link-list",
"container" => "",
"walker" => new Header_Menu_Walker()
)) ?>
</div>
</div>
</li>
<?php
}
?>
<?php
// check if didattica has menu
$theme_location = "menu-didattica";
$option_location = "item_menu_didattica";
unset($menu_obj);
if(isset($theme_locations[$theme_location]))
$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
if(isset($menu_obj) && !is_wp_error($menu_obj)) {
$landing_url = dsi_get_template_page_url("page-templates/didattica.php");
if($landing_url)
$items_wrap = '<ul class="%2$s"><li class="menu-title" ><div class="h3"><a class="list-item" href="'.$landing_url.'">'.__("Panoramica", "design_scuole_italia").'</a></div></li>%3$s</ul>';
else
$items_wrap = '<ul class="%2$s">%3$s</ul>';
?>
<li class="text-bluelectric menu-dropdown-simple-wrapper">
<a class="nav-link dropdown-toggle <?php echo $active_page == 'education' ? 'active' : ''?>" data-toggle="dropdown" role="button" href="#" aria-expanded="false" id="mainNavDropdown4"><?php _e("Didattica","design_scuole_italia"); ?></a>
<div class="dropdown-menu menu-dropdown dl-submenu menu-dropdown-simple" aria-labelledby="mainNavDropdown4">
<div class="link-list-wrapper">
<?php wp_nav_menu(array(
"menu" => $menu_obj,
"items_wrap" => $items_wrap,
"depth" => 1,
"menu_class" => "link-list",
"container" => "",
"walker" => new Header_Menu_Walker()
)) ?>
</div>
</div>
</li>
<?php
}
?>
</ul><!-- /nav-list -->
</nav>
<?php
$location = "menu-topright";
if ( has_nav_menu( $location ) ) {
echo '<nav aria-label="Argomenti">';
wp_nav_menu(array("theme_location" => $location, "depth" => 1, "menu_class" => "nav-list nav-list-secondary", "container" => ""));
echo '</nav>';
}
?>
</div><!-- /col nav-container -->
</div><!-- /row -->
</div><!-- /container -->
</div><!-- /sub-nav -->
</header><!-- /header -->
<?php get_template_part("template-parts/common/search-modal"); ?>
<?php
if(!is_user_logged_in())
get_template_part("template-parts/common/access-modal");
?>