-
Notifications
You must be signed in to change notification settings - Fork 1
/
header-mobile.php
182 lines (118 loc) · 4.34 KB
/
header-mobile.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
<?php
/**
* Template part: Header mobile
*
* template for mobile devices - logo, main menu etc.
*/
global $olea_woo_is_active;
?>
<div class="row clearfix">
<div id="site-title-mobile" class="small-12">
<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?> | <?php bloginfo( 'description' );?>" rel="home">
<?php do_action( 'olea_logo' ); ?>
</a>
</div>
<div class="mobile-sticky">
<div class="menu-toggler">
<span class="menu-title"><?php esc_html_e('Menu','olea'); ?></span>
<a href="#" title="<?php esc_attr_e('Toggle menu','olea') ;?>">
<span class="icon-menu"></span>
</a>
<div class="clearfix"></div>
</div>
<div class="mobile-dropdown">
<?php
$headblocks_option = apply_filters( "olea_options", "mobile_header_blocks", array() );
if( isset( $headblocks_option['enabled'] ) ) {
$headblocks = $headblocks_option['enabled'];
foreach ( $headblocks as $block ) {
$block_array_check = strpos( $block, "|");
// if are saved as resizable
if( $block_array_check ) {
$bl = explode("|", $block ); // $bl[0] - block name, $bl[1] - block width
switch ( $bl[0] ) {
//////////////////////////////////////////
case 'Shopping cart' :
/**
* IF WOOCOMMERCE is ACTIVATED
*
*/
if ( $olea_woo_is_active ) {
global $woocommerce;
echo '<div class="wrap-mini-cart-mobile">';
$cart_count = $woocommerce->cart->cart_contents_count;
$cart_link = get_permalink( wc_get_page_id( 'cart' ));
$cart_action = apply_filters( "olea_options", "cart_action", "popup" );
echo ($cart_action == 'page') ? '<a href="'. esc_url($cart_link) .'" class="olea-head-cart" id="olea-head-cart-mobile">' : '<div class="olea-head-cart mini-cart-toggle" id="olea-head-cart-mobile">';
?>
<span class="icon-shopping63 mini-cart-icon" aria-hidden="true"></span>
<span class="cart-contents">
<?php echo '<span class="count">'.intval($cart_count).'</span>'; ?>
<?php echo wp_kses_post($woocommerce->cart->get_cart_total()); ?>
</span>
<div class="clearfix"></div>
<?php echo ($cart_action == 'page') ? '</a>' : '</div>';
echo '<div class="mini-cart-list"><span class="arrow-up"></span><div class="widget_shopping_cart_content">';
woocommerce_get_template_part('mini','cart');
echo '</div></div>'; //end mini cart
echo '</div>'; // end wrap-mini-cart
} // endif $olea_woo_is_active
break;
//////////////////////////////////////////
case 'Menu mobile' :
?>
<nav id="main-nav-wrapper-mobile" class="small-12">
<?php
if ( has_nav_menu( 'main-mobile' ) ) {
$walker = new My_Walker;
wp_nav_menu( array(
'theme_location' => 'main-mobile',
//'menu' => 'Main menu',
'walker' => $walker,
'link_before' =>'',
'link_after' =>'',
'menu_id' => 'main-nav-mobile',
'menu_class' => 'navigation ',
'container' => false
)
);
}
?>
</nav>
<div class="clearfix"></div>
<?php
break;
//////////////////////////////////////////
case 'Search' :
if( $olea_woo_is_active ) {
as_get_product_search_form();
}else{
get_template_part('searchform','menu');
}
break;
//////////////////////////////////////////
case 'Widgets block' :
if ( is_active_sidebar( 'sidebar-header' ) ) {
dynamic_sidebar( 'sidebar-header' );
}
break;
//////////////////////////////////////////
case 'Widgets block 2' :
if ( is_active_sidebar( 'sidebar-header-2' ) ) {
dynamic_sidebar( 'sidebar-header-2' );
}
break;
//////////////////////////////////////////
case 'Widgets block 3' :
if ( is_active_sidebar( 'sidebar-header-3' ) ) {
dynamic_sidebar( 'sidebar-header-3' );
}
break;
}
}
}
}
?>
</div>
</div>
</div>