forked from strangerstudios/memberlite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
165 lines (143 loc) · 4.81 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
<?php
/**
* The template for displaying the header.
*
* Displays all of the <head> section and everything up to the "content" div.
*
* @package Memberlite
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php
do_action( 'memberlite_before_page' );
if ( function_exists( 'wp_body_open' ) ) {
wp_body_open();
} else {
do_action( 'wp_body_open' );
}
?>
<div id="page" class="hfeed site">
<?php
// Hide header output for the Blank page template.
if ( ! is_page_template( 'templates/blank.php' ) ) { ?>
<?php get_template_part( 'components/header/mobile', 'menu' ); ?>
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'memberlite' ); ?></a>
<?php do_action( 'memberlite_before_site_header' ); ?>
<header id="masthead" class="site-header" role="banner">
<div class="row">
<?php
$meta_login = get_theme_mod( 'meta_login', false );
if ( ! is_page_template( 'templates/interstitial.php' ) && ( ! empty( $meta_login ) || has_nav_menu( 'meta' ) || is_active_sidebar( 'sidebar-3' ) ) ) {
$show_header_right = true;
} else {
$show_header_right = false;
}
/**
* Filter to hide or show the right column area of the header.
*
* @param bool $show_header_right True to show the header right, false to hide it.
*
* @return bool $show_header_right
*/
$show_header_right = apply_filters( 'memberlite_show_header_right', $show_header_right );
?>
<div class="
<?php
if ( is_page_template( 'templates/interstitial.php' ) || empty( $show_header_right ) ) {
echo 'large-12';
} else {
echo 'medium-' . esc_attr( memberlite_getColumnsRatio( 'header-left' ) ); }
?>
columns site-branding">
<?php memberlite_the_custom_logo(); ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<span class="site-description"><?php bloginfo( 'description' ); ?></span>
</div><!-- .column4 -->
<?php if ( ! empty( $show_header_right ) ) { ?>
<div class="medium-<?php echo esc_attr( memberlite_getColumnsRatio( 'header-right' ) ); ?> columns header-right<?php if ( $meta_login == false ) { ?> no-meta-menu<?php } ?>">
<?php
if ( ! empty( $meta_login ) ) {
get_template_part( 'components/header/meta', 'member' );
}
if ( has_nav_menu( 'meta' ) ) {
wp_nav_menu(
array(
'theme_location' => 'meta',
'container' => 'nav',
'container_id' => 'meta-navigation',
'container_class' => 'meta-navigation',
'fallback_cb' => false,
)
);
}
if ( is_dynamic_sidebar( 'sidebar-3' ) ) {
dynamic_sidebar( 'sidebar-3' );
}
?>
</div><!-- .columns -->
<?php } ?>
<?php
// show the mobile menu toggle button
if ( is_active_sidebar( 'sidebar-5' ) || has_nav_menu( 'primary' ) ) { ?>
<div class="mobile-navigation-bar">
<button class="menu-toggle"><i class="fa fa-bars"></i></button>
</div>
<?php }
?>
</div><!-- .row -->
</header><!-- #masthead -->
<?php do_action( 'memberlite_before_site_navigation' ); ?>
<?php if ( ! is_page_template( 'templates/interstitial.php' ) && has_nav_menu( 'primary' ) ) { ?>
<?php
$sticky_nav = get_theme_mod( 'sticky_nav' );
if ( $sticky_nav == true ) { ?>
<div class="site-navigation-sticky-wrapper">
<?php }
?>
<nav id="site-navigation">
<?php
if ( has_nav_menu( 'primary' ) ) {
$primary_defaults = array(
'theme_location' => 'primary',
'container' => 'div',
'container_class' => 'main-navigation row',
'menu_class' => 'menu large-12 columns',
'fallback_cb' => false,
);
wp_nav_menu( $primary_defaults );
}
?>
</nav><!-- #site-navigation -->
<?php
if ( $sticky_nav == true ) { ?>
</div> <!-- .site-navigation-sticky-wrapper -->
<script>
jQuery(document).ready(function ($) {
var s = $("#site-navigation");
var pos = s.position();
$(window).scroll(function() {
var windowpos = $(window).scrollTop();
if ( windowpos >= pos.top ) {
s.addClass("site-navigation-sticky");
} else {
s.removeClass("site-navigation-sticky");
}
});
});
</script>
<?php }
}
} // End if(). ?>
<?php do_action( 'memberlite_before_content' ); ?>
<div id="content" class="site-content">
<?php get_template_part( 'components/header/masthead' ); ?>
<?php if ( ! is_page_template( 'templates/fluid-width.php' ) && ! is_page_template( 'templates/blank.php' ) && ! is_404() ) { ?>
<div class="row">
<?php } ?>