-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlayout.html.php
More file actions
73 lines (64 loc) · 1.87 KB
/
Copy pathlayout.html.php
File metadata and controls
73 lines (64 loc) · 1.87 KB
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
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<!DOCTYPE html>
<html>
<head>
<?php echo head_contents();?>
<title<?php echo $title;?></title>
<meta name="description" content="<?php echo $description; ?>"/>
<link rel="canonical" href="<?php echo $canonical; ?>" />
<?php if (publisher()): ?>
<link href="<?php echo publisher() ?>" rel="publisher" /><?php endif; ?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
function setTheme(themeName) {
localStorage.setItem('theme', themeName);
//document.documentElement.className = themeName;
var link = document.createElement('link');
link.rel = 'stylesheet';
if (themeName == "theme-dark") {
link.href = '<?php echo theme_path();?>css/dark.css';
} else {
link.href = '<?php echo theme_path();?>css/light.css';
}
document.head.appendChild(link);
}
// function to toggle between light and dark theme
function toggleTheme() {
if (localStorage.getItem('theme') === 'theme-dark') {
setTheme('theme-light');
} else {
setTheme('theme-dark');
}
}
// Immediately invoked function to set the theme on initial load
(function() {
if (localStorage.getItem('theme') === 'theme-dark') {
setTheme('theme-dark');
} else {
setTheme('theme-light');
}
})();
</script>
</head>
<body>
<?php if (facebook()) { echo facebook(); } ?>
<?php if (login()) { toolbar(); } ?>
<header>
<?php if(is_index()) {?>
<h1><a href="<?php echo site_url();?>"><?php echo blog_title();?></a></h1>
<?php } else { ?>
<h1><a href="<?php echo site_url();?>"><?php echo blog_title();?></a></h1>
<?php } ?>
<nav>
<?php echo menu();?>
</nav>
</header>
<button id="switch" onclick="toggleTheme()">🌙/☀</button>
<div>
<?php echo content();?>
</div>
<footer>
<?php echo copyright();?> | <?php echo blog_description();?>
</footer>
</body>
</html>