-
Notifications
You must be signed in to change notification settings - Fork 9
/
header.php
194 lines (162 loc) · 6.78 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
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
188
189
190
191
192
193
194
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @license GPL 2.0
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php if ( function_exists( 'wp_body_open' ) ) {
wp_body_open();
} ?>
<div id="page" class="hfeed site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'siteorigin-north' ); ?></a>
<?php if ( siteorigin_setting( 'masthead_text_above' ) && ! is_active_sidebar( 'topbar-sidebar' ) ) { ?>
<div id="topbar">
<?php if ( class_exists( 'Woocommerce' ) && is_store_notice_showing() ) {
siteorigin_north_wc_demo_store();
} ?>
<div class="container">
<p><?php echo wp_kses_post( siteorigin_setting( 'masthead_text_above' ) ); ?></p>
</div>
</div><!-- #topbar -->
<?php } elseif ( is_active_sidebar( 'topbar-sidebar' ) ) { ?>
<div id="topbar">
<?php if ( class_exists( 'Woocommerce' ) && is_store_notice_showing() ) {
siteorigin_north_wc_demo_store();
} ?>
<div id="topbar-widgets" class="container">
<?php $siteorigin_north_masthead_sidebar = wp_get_sidebars_widgets(); ?>
<div class="widgets widgets-<?php echo count( $siteorigin_north_masthead_sidebar['topbar-sidebar'] ); ?>" aria-label="<?php esc_attr_e( 'Top Bar Sidebar', 'siteorigin-north' ); ?>">
<?php dynamic_sidebar( 'topbar-sidebar' ); ?>
</div>
</div><!-- #topbar-widgets -->
</div><!-- #topbar -->
<?php } elseif ( class_exists( 'Woocommerce' ) && is_store_notice_showing() ) { ?>
<div id="topbar">
<?php siteorigin_north_wc_demo_store(); ?>
</div><!-- #topbar -->
<?php } ?>
<?php if ( ! siteorigin_page_setting( 'hide_masthead', false ) ) { ?>
<header id="masthead" class="site-header layout-<?php echo sanitize_html_class( str_replace( '_', '-', siteorigin_setting( 'masthead_layout' ) ) ); ?> <?php if ( siteorigin_setting( 'navigation_sticky' ) ) {
echo 'sticky-menu';
} ?>" <?php if ( siteorigin_setting( 'navigation_sticky_scale' ) ) {
echo 'data-scale-logo="true"';
} ?> >
<div class="container">
<div class="container-inner">
<div class="site-branding">
<?php siteorigin_north_display_logo(); ?>
<?php if ( siteorigin_setting( 'branding_site_description' ) ) { ?>
<p class="site-description"><?php bloginfo( 'description' ); ?></p>
<?php } ?>
</div><!-- .site-branding -->
<nav id="site-navigation" class="main-navigation">
<?php if ( siteorigin_page_setting( 'layout' ) !== 'stripped' ) { ?>
<?php if ( function_exists( 'ubermenu' ) ) { ?>
<?php
ubermenu(
'main',
array( 'theme_location' => 'primary' )
);
?>
<?php } elseif ( function_exists( 'max_mega_menu_is_enabled' ) && max_mega_menu_is_enabled( 'primary' ) ) { ?>
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
) );
?>
<?php } else { ?>
<?php
$menu_id = ( wp_get_nav_menu_name( 'primary' ) ? wp_get_nav_menu_name( 'primary' ) : false );
if ( class_exists( 'Woocommerce' ) ) {
// Work out if the WooCommerce cart is enabled and showing
if ( ( ! ( is_cart() || is_checkout() ) && siteorigin_setting( 'woocommerce_display_cart' ) ) || ( ( is_cart() || is_checkout() ) && siteorigin_setting( 'woocommerce_display_checkout_cart' ) ) ) {
$show_mini_cart = true;
}
}
if ( ( $menu_id && wp_get_nav_menu_object( $menu_id )->count ) || siteorigin_setting( 'navigation_search' ) || isset( $show_mini_cart ) ) { ?>
<a href="#menu" id="mobile-menu-button">
<?php siteorigin_north_display_icon( 'menu' ); ?>
<?php if ( siteorigin_setting( 'responsive_menu_text' ) ) { ?>
<?php echo esc_html( siteorigin_setting( 'responsive_menu_text' ) ); ?>
<span class="screen-reader-text"><?php esc_html_e( 'Menu', 'siteorigin-north' ); ?></span>
<?php } ?>
</a>
<?php
}
wp_nav_menu( array(
'theme_location' => 'primary',
'menu_id' => 'primary-menu',
) );
if ( isset( $show_mini_cart ) ) {
global $woocommerce;
?>
<ul class="shopping-cart">
<li>
<a class="shopping-cart-link" href="<?php echo esc_url( wc_get_cart_url() ); ?>">
<span class="screen-reader-text"><?php esc_html_e( 'View shopping cart', 'siteorigin-north' ); ?></span>
<span class="north-icon-cart"></span>
<span class="shopping-cart-text"><?php esc_html_e( ' View Cart ', 'siteorigin-north' ); ?></span>
<span class="shopping-cart-count"><?php echo WC()->cart->cart_contents_count; ?></span>
</a>
<ul class="shopping-cart-dropdown" id="cart-drop">
<?php
$instance = array(
'title' => '',
);
the_widget( 'WC_Widget_Cart', $instance );
?>
</ul>
</li>
</ul>
<?php
}
}
?>
<?php if ( siteorigin_setting( 'navigation_search' ) && ! ( function_exists( 'ubermenu' ) || function_exists( 'max_mega_menu_is_enabled' ) ) ) { ?>
<button class="north-search-icon">
<label class="screen-reader-text"><?php esc_html_e( 'Open search bar', 'siteorigin-north' ); ?></label>
<?php siteorigin_north_display_icon( 'search' ); ?>
</button>
<?php } ?>
<?php } ?>
<?php if ( siteorigin_page_setting( 'layout' ) == 'stripped' ) { ?>
<ul>
<li>
<a href="" class="stripped-backlink" onclick="window.history.go( -1 ); return false;">
<?php esc_html_e( 'Go back', 'siteorigin-north' ); ?>
</a>
</li>
</ul>
<?php } ?>
</nav><!-- #site-navigation -->
</div><!-- .container-inner -->
</div><!-- .container -->
<?php if ( siteorigin_setting( 'navigation_search' ) ) { ?>
<div id="header-search">
<div class="container">
<label for='s' class='screen-reader-text'><?php esc_html_e( 'Search for:', 'siteorigin-north' ); ?></label>
<?php get_search_form(); ?>
<a id="close-search">
<span class="screen-reader-text"><?php esc_html_e( 'Close search bar', 'siteorigin-north' ); ?></span>
<?php siteorigin_north_display_icon( 'close' ); ?>
</a>
</div>
</div>
<?php } ?>
</header><!-- #masthead -->
<?php } ?>
<?php do_action( 'siteorigin_north_content_before' ); ?>
<div id="content" class="site-content">
<div class="container">
<?php do_action( 'siteorigin_north_content_top' ); ?>