-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
109 lines (100 loc) · 3.35 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
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
$post = get_post();
wp_head() ?>
</head>
<body <?php echo 'class="' . join(' ', str_replace("custom-background", "", get_body_class())) . '"'; ?>>
<div id="scoutflik"><img
src="<?php echo get_template_directory_uri() . '/images/Tab-vertical.png' ?>">
</div>
<?php
if (is_home() || is_archive() || !has_post_thumbnail($post->id)) {
$get_header_image = get_header_image();
} else {
$get_header_image = get_the_post_thumbnail_url($post->id, 'pageHeader');
}
$luminance = get_avg_luminance($get_header_image);
if ($luminance > 100 || $luminance == null) {
$imgLum = "dark";
} else {
$imgLum = "light";
}
?>
<header
class="main-header <?php echo $imgLum; ?> <?php echo $luminance; ?>">
<div id="header-image"
class="<?php echo $imgLum; ?> <?php echo $luminance; ?>"
style="background-image: url(<?php echo $get_header_image; ?>);">
<div id="hamburger">
<span></span>
<span></span>
<span></span>
</div>
<nav id="topMeny">
<?php wp_nav_menu(array('container_id'=> 'main-menu', 'theme_location'=>"main" ));
$post = get_post();
if (is_page()) {
/* Get an array of Ancestors and Parents if they exist */
$parents = get_post_ancestors($post->ID);
/* Get the top Level page->ID count base 1, array base 0 so -1 */
$id = ($parents) ? $parents[count($parents)-1]: $post->ID;
/* Get the parent and set the $class with the page slug (post_name) */
$parent = get_post($id);
//var_dump($id);
/*wp_list_pages( array(
'title_li' => '',
'child_of' => $parent->ID,
) );*/
}
?>
</nav>
<?php the_kårnamn($imgLum); ?>
<p class="slogan"><?php echo get_bloginfo('description') ?>
</p>
</div>
<?php
$ua = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8');
if (preg_match('~MSIE|Internet Explorer~i', $ua) || (strpos($ua, 'Trident/7.0') !== false && strpos($ua, 'rv:11.0') !== false)) {
// do stuff for IE?>
<div id="IE-ALLERT">
<div class="ie-allert-content">
<h2><?php echo ucwords(get_bloginfo('name'))?>
</h2>
<div class="info">
<p>Denna sidan stödjer inte <strong>Internet Explorer</strong>.</p>
<p>denna sidan stöjer i stortsätt alla mobilers webbläsare så testa med den</p>
<h3>Webbläsare som stöds</h3>
<ul>
<li>
<a href="https://www.google.com/chrome/">Chrome</a>
</li>
<li>
<a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a>
</li>
<li>
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge">Edge</a>
</li>
<li>
<a href="https://support.apple.com/downloads/safari">Safari</a>
</li>
<li>
<a href="https://www.opera.com/download">Opera</a>
</li>
</ul>
<p>
Varmt välkommen tillbaka med en modärnare och säkrare webbläsare!
</p>
</div>
</div>
</div>
<?php
die();
}
?>
<?php get_template_part('inc/breadcrumbs', 'breadcrumbs'); ?>
</header>
<?php