This repository was archived by the owner on Feb 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheader.php
163 lines (137 loc) · 6.15 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
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till #main div
*
* @package Odin
* @since 2.2.0
*/
?><!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php if ( ! get_option( 'site_icon' ) ) : ?>
<link href="<?php echo get_template_directory_uri(); ?>/assets/images/favicon.ico" rel="shortcut icon" />
<?php endif; ?>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/assets/js/html5.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<a id="skippy" class="sr-only sr-only-focusable" href="#content">
<div class="container">
<span class="skiplink-text"><?php _e( 'Skip to content', 'haste-store' ); ?></span>
</div>
</a>
<header id="header" role="banner">
<?php
$header_image = get_header_image();
if ( ! empty( $header_image ) ) :
?>
<div class="page-header">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<img src="<?php echo esc_url( $header_image ); ?>" height="<?php esc_attr_e( $header_image->height ); ?>" width="<?php esc_attr_e( $header_image->width ); ?>" alt="" />
</a>
</div><!-- .site-header-->
<?php endif; ?>
<div id="main-navigation" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-navigation">
<span class="sr-only"><?php _e( 'Toggle navigation', 'haste-store' ); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand">
<?php echo is_home() ? '<h1 class="site-title">' : '<span class="h1 site-title">' ; ?>
<?php odin_the_custom_logo(); ?>
<?php echo is_home() ? '</h1>' : '</span>' ; ?>
</div>
</div>
<?php if ( ! is_page_template( 'page-landing.php' ) ) : ?>
<nav class="collapse navbar-collapse navbar-main-navigation <?php echo is_woocommerce_activated() ? 'navbar-left' : 'navbar-right'; ?>" role="navigation">
<?php
wp_nav_menu(
array(
'theme_location' => 'main-menu',
'depth' => 2,
'container' => false,
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'Odin_Bootstrap_Nav_Walker::fallback',
'walker' => new Odin_Bootstrap_Nav_Walker()
)
);
?>
</nav><!-- .navbar-collapse -->
<?php if( is_woocommerce_activated() ) : ?>
<nav class="navbar-right">
<?php if ( get_option( 'users_can_register' ) ) : ?>
<?php if ( is_user_logged_in() ) : ?>
<div class="btn-group hidden-xs" role="group" aria-label="login">
<button class="btn btn-outline navbar-btn dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
<span class="hidden-xs">
<?php
printf( esc_html__( 'Hello, %s!', 'haste-store' ), haste_get_user_name() );
?>
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="<?php echo wc_get_endpoint_url( 'orders', '', get_permalink( get_option('woocommerce_myaccount_page_id') ) );?>">
<span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
<?php _e('My orders', 'haste-store'); ?>
</a>
</li>
<li>
<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>">
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
<?php _e('My account', 'haste-store'); ?></a>
</li>
<li>
<a href="<?php echo wp_logout_url( get_permalink() ); ?>">
<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
<?php _e('Logout', 'haste-store'); ?></a>
</li>
</ul>
</div>
<?php else : ?>
<p class="navbar-text hidden-xs">
<?php _e('Hello, guest user!', 'haste-store'); ?>
</p>
<div class="btn-group hidden-xs" role="group" aria-label="login">
<a class="btn btn-outline navbar-btn" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>">
<?php _e('Login', 'haste-store')?></a>
<a class="btn btn-outline navbar-btn" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>">
<?php _e('Register', 'haste-store')?></a>
</div>
<?php endif; // is_user_logged_in ?>
<?php endif; // users_can_register ?>
<?php $items = WC()->cart->get_cart_contents_count(); ?>
<button type="button" class="btn btn-primary navbar-btn dropdown-toggle btn-cart" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span>
<span class="badge items-<?php echo $items; ?>"><?php echo $items; ?></span>
<span class="sr-only"><?php _e('Cart', 'haste-store')?></span>
<span class="caret"></span>
</button>
<?php odin_header_cart() ?>
</nav><!-- .navbar-right -->
<?php endif; // is_woocommerce_activated ?>
<?php endif; // is_landing ?>
</div><!-- .container-->
</div><!-- #main-navigation-->
</header><!-- #header -->
<div id="wrapper">
<div class="wrapper-row">
<?php if( !is_front_page() && !is_page_template( 'page-home.php' ) && !is_page_template( 'page-landing.php' ) ) : ?>
<div class="breadcrumb-wrapper">
<?php do_action( 'odin_content_top' ); ?>
</div>
<?php endif; ?>