-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
executable file
·187 lines (173 loc) · 7.72 KB
/
header.php
File metadata and controls
executable file
·187 lines (173 loc) · 7.72 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
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
<?php
/**
* Header template file.
*
* Outputs the document head and site header, including branding,
* search UI, and the primary navigation trigger.
*
* @package tailwind_wordpress_template
* @since 1.0.0
*/
if (!defined('ABSPATH')) {
exit;
}
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0">
<link
rel="profile"
href="https://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class('bg-white text-gray-900'); ?>>
<?php wp_body_open(); ?>
<div
id="page-loader"
class="fixed inset-0 bg-white z-50 flex items-center justify-center transition-opacity duration-500 ease-in-out opacity-100 pointer-events-auto">
<div class="text-center">
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-primary-700 mx-auto mb-4"></div>
<div class="text-primary-700 text-sm"><?php echo esc_html__('Loading...', 'tailwind_wordpress_template'); ?></div>
</div>
</div>
<div
id="page"
class="site min-h-screen flex flex-col">
<header
id="masthead"
class="<?php classnames_echo(
'site-header',
'fixed',
'left-0',
'right-0',
'z-20',
'bg-primary-700',
'text-white',
'pt-[10px]',
'lg:pt-[30px]',
['top-[32px] max-[782px]:top-[46px]' => is_admin_bar_showing()],
['top-0' => !is_admin_bar_showing()],
); ?>">
<div class="container mx-auto px-4 py-2">
<div class="site-header-content flex flex-col justify-between">
<div class="site-header-top flex items-center gap-4 lg:gap-8 flex-1 min-w-0 justify-between">
<div class="site-branding flex flex-wrap gap-y-1 gap-10 items-center flex-1 lg:flex-none">
<?php
$tag_class = 'site-title text-lg md:text-xl pb-1';
$logo = tailwind_wordpress_template_get_custom_logo();
if (!empty($logo)) {
echo $logo;
$tag = 'span';
} else {
$tag = (is_front_page() && is_home()) ? 'h1' : 'p';
}
?>
<<?php echo $tag; ?> class="<?php echo $tag_class; ?>">
<a
href="<?php echo esc_url(home_url('/')); ?>"
rel="home">
<?php bloginfo('name'); ?>
</a>
</<?php echo $tag; ?>>
<?php
$description = get_bloginfo('description', 'display');
if ($description || is_customize_preview()) :
?>
<p class="site-description text-sm text-gray-600"><?php echo $description; ?></p>
<?php
endif;
?>
</div>
<div class="search-area relative flex items-center gap- flex-shrink-0">
<button
id="search-toggle"
type="button"
class="search-toggle-btn lg:hidden flex items-center justify-center p-1 rounded-full hover:bg-white/60 focus:bg-white/60 transition-colors duration-200"
aria-label="<?php echo __('Open Search', 'tailwind_wordpress_template'); ?>"
aria-expanded="false"
aria-controls="search-form-wrapper">
<?php render_icon('icon-search'); ?>
</button>
<div
id="search-form-wrapper"
class="search-form-wrapper fixed lg:static top-0 left-0 right-0 bottom-0 bg-primary-700/90 lg:bg-transparent shadow-lg lg:shadow-none z-30 opacity-0 lg:opacity-100 backdrop-blur-sm -translate-y-2 lg:-translate-y-0 pointer-events-none lg:pointer-events-auto transition-all duration-300 ease-in-out flex items-center justify-center">
<div class="container mx-auto flex items-center justify-center">
<form
role="search"
method="get"
class="search-form flex flex-col lg:flex-row items-center gap-6 w-full mx-auto p-2 lg:p-0"
action="<?php echo esc_url(home_url('/')); ?>">
<div class="grow flex p-1 bg-white gap-1">
<label
class="sr-only"
for="search-field">
<?php echo __('Search', 'tailwind_wordpress_template'); ?>
</label>
<input
type="search"
id="search-field"
class="lg:text-sm lg:h-6 grow search-field pl-4 pr-2 text-gray-900 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-primary-700/40 focus:border-transparent"
placeholder="<?php echo __('Enter search keywords...', 'tailwind_wordpress_template'); ?>"
value="<?php echo get_search_query(); ?>"
name="s"
required />
<button
type="submit"
class="search-submit lg:w-6 lg:h-6 flex items-center justify-center text-primary-700 hover:bg-primary-700 focus:bg-primary-700 hover:text-white focus:text-white transition-colors duration-200"
aria-label="<?php echo __('Search'); ?>">
<?php render_icon('icon-search'); ?>
<span class="sr-only"><?php echo __('Search'); ?></span>
</button>
</div>
<button
type="button"
id="search-close"
class="search-close-btn w-8 h-8 lg:hidden flex items-center justify-center p-2 border border-white hover:bg-primary-800 transition-colors duration-200 text-white"
aria-label="<?php echo __('Close Search', 'tailwind_wordpress_template'); ?>">
<?php render_icon('icon-close'); ?>
</button>
</form>
</div>
</div>
<button
id="nav-toggle"
type="button"
class="nav-toggle-btn lg:hidden flex items-center justify-center p-1 hover:bg-white/60 focus:bg-white/60 transition-colors duration-200"
aria-label="<?php echo __('Open Navigation Menu', 'tailwind_wordpress_template'); ?>"
aria-expanded="false"
aria-controls="nav-menu-wrapper">
<?php render_icon('icon-menu'); ?>
</button>
</div>
</div>
</div>
</div>
<nav
id="site-navigation"
class="site-header-bottom main-navigation absolute lg:static left-2 right-2 bottom-0 lg:bottom-auto transform translate-y-full lg:translate-y-0 opacity-0 lg:opacity-100 pointer-events-none lg:pointer-events-auto transition-all duration-300 ease-in-out bg-secondary-50 lg:bg-transparent text-gray-900 lg:text-inherit">
<div class="container mx-auto px-4 pt-4 pb-4 lg:pb-0 text-center">
<?php
wp_nav_menu([
'theme_location' => 'primary',
'menu_id' => 'primary-menu',
'container' => false,
'menu_class' => 'main-menu flex flex-col lg:flex-row justify-between',
'fallback_cb' => false,
]);
?>
</div>
</nav>
</header>
<div
id="content"
class="<?php classnames_echo(
'site-content',
'flex-grow',
'relative',
'z-10',
is_front_page() ? 'bg-primary-50' : 'bg-white',
); ?>">