-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathheader.php
133 lines (111 loc) · 5.46 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
<?php
$loginurl = is_user_logged_in() && class_exists(WISVCH\Portal\Init::class) ? WISVCH\Portal\Init::getUrl() : site_url('portal');
?><!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js">
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#058cce">
<link rel="icon" href="<?=RECHALLENGE_URI?>/assets/images/favicon.png">
<link rel="stylesheet" href="https://use.typekit.net/uet5duo.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(is_front_page() ? 'front-page' : ''); ?>>
<div class="page-container">
<!-- Page header -->
<header class="page-header">
<!-- Title Bar -->
<div class="title-bar" data-responsive-toggle="nav-menu" data-hide-for="large">
<div class="row collapse">
<div class="small-6 medium-5 bg-left column">
<a class="logo-small" href="<?=esc_url(site_url('/'))?>">
<img src="<?php echo RECHALLENGE_URI; ?>/assets/images/ch-logo.png" alt="<?=esc_attr(get_bloginfo('sitename'))?>" class="logo-small">
</a>
</div>
<div class="small-6 medium-7 bg-right column">
<div class="float-right">
<?php
// @TODO: make link to portal dynamic. see: lib/Menu.php
if (is_user_logged_in()) {
echo '<a class="login-button button alert account-button" href="'.site_url('portal').'">Account</a>';
} else {
echo '<a class="login-button button alert" href="'.site_url('portal').'" data-open="login-form">Login</a>';
}
?>
<button class="wisv-menu-icon hamburger hamburger--collapse" type="button" data-toggle aria-label="Navigation menu">
<span class="hamburger-box"><span class="hamburger-inner"></span></span>
</button>
</div>
</div>
</div>
</div>
<!-- Top Bar -->
<div class="wisv-header left">
<div class="wisv-header right">
<div class="center row">
<nav class="top-bar" id="nav-menu">
<div class="top-bar-left show-for-large">
<div class="logo-wrapper">
<a class="logo" href="<?=esc_url(site_url('/'))?>">
<img src="<?=RECHALLENGE_URI?>/assets/images/ch-logo.png" width="300" height="90" alt="<?=esc_attr(get_bloginfo('sitename'))?>">
</a>
</div>
</div>
<div class="top-bar-right">
<?php
wp_nav_menu([
"container" => "",
"container_class" => "",
"items_wrap" => '<ul class="vertical large-horizontal menu">%3$s</ul>',
"menu_class" => "",
"menu_id" => "",
"depth" => 1,
"fallback_cb" => false,
"theme_location" => "main-nav",
]);
?>
</div>
</nav>
</div>
</div>
</div>
<?php
// Load page title template part. Many corner cases (unfortunately), concerning the page children.
if (is_front_page()) {
get_template_part("parts/header/page-title", "front");
} else {
global $post;
// Prepare data for page title and subpage menu.
if (is_home() || is_singular('post')) { // News archive
$page = get_post(get_option("page_for_posts"));
// Get subpages
$children = get_pages([
'child_of' => $page->post_parent,
'sort_column' => 'menu_order,post_title',
]);
} elseif (is_page()) { // Regular page
// Get subpages
$children = get_pages([
'child_of' => $post->post_parent !== 0 ? $post->post_parent : $post->ID,
'sort_column' => 'menu_order,post_title',
]);
} elseif (is_archive() || is_post_type_archive() || is_singular(['ambassador', 'board', 'committee', 'company', 'honorary_member', 'job_opening'])) { // Custom post types
// Get aux page ID
$id = rechallenge_get_aux_page_id();
$post_parent = wp_get_post_parent_id($id);
// Get subpages
$children = get_pages([
'child_of' => $post_parent !== 0 ? $post_parent : $id,
'sort_column' => 'menu_order,post_title',
]);
}
// Load page title template
include(locate_template('parts/header/page-title.php'));
// Load sub navigation if has subpages
if (count($children) > 0) {
include(locate_template('parts/header/sub-nav.php'));
}
}
?>
</header>