-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathheader.php
145 lines (145 loc) · 5.92 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
<?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 Akina
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title itemprop="name">
<?php
global $page, $paged;
wp_title('-', true, 'right');
bloginfo('name');
$site_description = get_bloginfo('description', 'display');
if ($site_description && (is_home() || is_front_page())) echo " - $site_description";
if ($paged >= 2 || $page >= 2) echo ' - ' . sprintf(__('第 %s 页'), max($paged, $page));
?>
</title>
<?php
if (akina_option('akina_meta') == true) {
$keywords = '';
$description = '';
if (is_singular()) {
$keywords = '';
$tags = get_the_tags();
$categories = get_the_category();
if ($tags) {
foreach ($tags as $tag) {
$keywords .= $tag->name . ',';
};
};
if ($categories) {
foreach ($categories as $category) {
$keywords .= $category->name . ',';
};
};
$description = mb_strimwidth(str_replace("\r\n", '', strip_tags($post->post_content)), 0, 240, '…');
} else {
$keywords = akina_option('akina_meta_keywords');
$description = akina_option('akina_meta_description');
};
?>
<meta name="description" content="<?php echo $description; ?>"/>
<meta name="keywords" content="<?php echo $keywords; ?>"/>
<?php } ?>
<link rel="shortcut icon" href="<?php bloginfo('template_url'); ?>/images/favicon.ico"/>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/OwO/meme.css"/>
<?php if (akina_option('live2d_s') != '0') { ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/live2d/css/live2d.css"/>
<?php } ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/inc/css/sweet-alert.css"/>
<?php if (akina_option('shuoshuo') == 'yes') { ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/inc/css/shuoshuo.css"/>
<?php } ?>
<?php if (akina_option('picture_m') == 'single') { ?>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/zooming@1.5.0/build/zooming.min.js"></script>
<?php } ?>
<?php if (akina_option('laziness_img') != '0') { ?>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload.min.js"></script>
<?php } ?>
<?php wp_head(); ?>
<?php if (akina_option('google_analytics_1')) { ?>
<script async src="<?php echo akina_option('google_analytics_1'); ?>"></script>
<?php } ?>
<?php if (akina_option('google_analytics_2')) { ?>
<script>
<?php echo akina_option('google_analytics_2'); ?>
</script>
<?php } ?>
<!--[if IE]>
<script type="text/javascript">
if (!!window.ActiveXObject || "ActiveXObject" in window) {
alert('请抛弃万恶的IE浏览器吧!请更换浏览器访问本博客呢……');
}
</script>
<![endif]-->
<?php if (akina_option('web_title') != '0') { ?>
<script type="text/javascript">
var title = {
focus: '<?php echo akina_option('onfocus'); ?>',
blur: '<?php echo akina_option('onblur'); ?>',
}
</script>
<?php } ?>
<?php if (akina_option('right_click') != '0') { ?>
<script type="text/javascript">
document.oncontextmenu = function () {
return false;
};
</script>
<?php } ?>
</head>
<body <?php body_class(); ?>>
<section id="main-container">
<?php if (!akina_option('head_focus')) {
$filter = akina_option('focus_img_filter');
?>
<div class="headertop <?php echo $filter; ?>">
<?php get_template_part('layouts/imgbox'); ?>
</div>
<?php } ?>
<div id="page" class="site wrapper">
<header class="site-header" role="banner">
<div class="site-top">
<div class="site-branding">
<?php if (akina_option('akina_logo')){ ?>
<div class="site-title">
<a href="<?php bloginfo('url'); ?>"><img src="<?php echo akina_option('akina_logo'); ?>"></a>
</div>
<?php }else{ ?>
<h1 class="site-title">
<a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a>
</h1>
<?php } ?><!-- logo end -->
</div>
<!-- .site-branding -->
<?php header_user_menu();
if (akina_option('top_search') == 'yes') { ?>
<div class="searchbox">
<i class="iconfont js-toggle-search iconsearch"></i>
</div>
<?php } ?>
<div class="lower"><?php if (!akina_option('shownav')) { ?>
<div id="show-nav" class="showNav">
<div class="line line1"></div>
<div class="line line2"></div>
<div class="line line3"></div>
</div><?php } ?>
<nav><?php wp_nav_menu(array('depth' => 2, 'theme_location' => 'primary', 'container' => false)); ?></nav>
<!-- #site-navigation -->
</div>
</div>
</header>
<!-- #masthead -->
<?php the_headPattern(); ?>
<div id="content"
class="site-content">