-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheader_style_default.php
330 lines (273 loc) · 16.7 KB
/
header_style_default.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<div class="gbtr_header_wrapper">
<div class="container_12">
<div class="grid_3">
<a href="<?php echo home_url(); ?>" class="gbtr_logo">
<?php
if ( !$theretailer_theme_options['site_logo'] ) {
if (is_ssl()) {
$site_logo_img = str_replace("http://", "https://", get_template_directory_uri() . "/images/logo.png");
} else {
$site_logo_img = get_template_directory_uri() . "/images/logo.png";
}
} else {
if (is_ssl()) {
$site_logo_img = str_replace("http://", "https://", $theretailer_theme_options['site_logo']);
} else {
$site_logo_img = $theretailer_theme_options['site_logo'];
}
}
?>
<img src="<?php echo $site_logo_img; ?>" alt="" />
</a>
</div>
<script type="text/javascript">
//<![CDATA[
// Set pixelRatio to 1 if the browser doesn't offer it up.
var pixelRatio = !!window.devicePixelRatio ? window.devicePixelRatio : 1;
logo_image = new Image();
(function($){
$(window).load(function(){
if (pixelRatio > 1) {
$('.gbtr_logo img').each(function() {
var logo_image_width = $(this).width();
var logo_image_height = $(this).height();
$(this).css("width", logo_image_width);
$(this).css("height", logo_image_height);
<?php if ( !$theretailer_theme_options['site_logo'] ) { ?>
$(this).attr('src', '<?php echo get_template_directory_uri(); ?>/images/logo@2x.png');
<?php } else if ($theretailer_theme_options['site_logo_retina']) { ?>
$(this).attr('src', '<?php echo $theretailer_theme_options['site_logo_retina'] ?>');
<?php } ?>
});
}
})
})(jQuery);
//]]>
</script>
<div class="grid_9">
<div class="menus_envelope">
<div class="menus_wrapper
<?php if (($theretailer_theme_options['shopping_bag_style']) && ($theretailer_theme_options['shopping_bag_style'] == "style2")) { ?>
menus_wrapper_shopping_bag_mobile_style
<?php } ?>
<?php if ((!$theretailer_theme_options['shopping_bag_in_header']) || ($theretailer_theme_options['shopping_bag_in_header'] == "0")) { ?>
menus_wrapper_no_shopping_bag_in_header
<?php } ?>
<?php if ( !has_nav_menu( 'secondary' ) ) { ?>
menus_wrapper_no_secondary_menu
<?php } ?>
" <?php if ( ($theretailer_theme_options['catalog_mode']) && ($theretailer_theme_options['catalog_mode'] == 1) ) { ?>style="margin:0"<?php } ?>>
<div class="gbtr_first_menu">
<div class="gbtr_first_menu_inside">
<?php
if ( in_array( 'ubermenu/ubermenu.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
?>
<ul>
<?php
} else {
?>
<ul id="menu" class="sf-menu">
<?php
}
?>
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<?php
wp_nav_menu(array(
'theme_location' => 'primary',
'container' =>false,
'menu_class' => '',
'echo' => true,
'items_wrap' => '%3$s',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'depth' => 0,
'fallback_cb' => false,
));
?>
<?php else: ?>
<a>Define your primary navigation.</a>
<?php endif; ?>
</ul>
<div class="clr"></div>
</div>
</div>
<div class="gbtr_second_menu">
<ul>
<?php if ( has_nav_menu( 'secondary' ) ) : ?>
<?php
wp_nav_menu(array(
'theme_location' => 'secondary',
'container' =>false,
'menu_class' => '',
'echo' => true,
'items_wrap' => '%3$s',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'depth' => 0,
'fallback_cb' => false,
));
?>
<?php else: ?>
<style>
.gbtr_first_menu_inside {
border-bottom: 0;
}
</style>
<?php endif; ?>
</ul>
</div>
</div>
<div class="
<?php if ((!$theretailer_theme_options['shopping_bag_in_header']) || ($theretailer_theme_options['shopping_bag_in_header'] == "0")) { ?>
menus_wrapper_no_shopping_bag_in_header
<?php } ?> mobiles_menus_wrapper">
<div class="gbtr_menu_mobiles">
<div class="gbtr_menu_mobiles_inside
<?php if ( ($theretailer_theme_options['catalog_mode']) && ($theretailer_theme_options['catalog_mode'] == 1) ) { ?>
gbtr_menu_mobiles_inside_catalog_mode
<?php } ?>
">
<select>
<option selected><?php _e('Navigation', 'theretailer'); ?></option>
<?php
class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu{
function start_lvl(&$output, $depth = 0, $args = array()){
$indent = str_repeat("\t", $depth); // don't output children opening tag (`<ul>`)
}
function end_lvl(&$output, $depth = 0, $args = array()){
$indent = str_repeat("\t", $depth); // don't output children closing tag
}
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0){
// add spacing to the title based on the depth
$item->title = str_repeat("—", $depth). " " . $item->title;
parent::start_el($output, $item, $depth, $args);
$output = preg_replace( '/ title="[^"]*"/', '', $output );
$output = str_replace("<li", "\n<option", $output);
$output = str_replace('><a href=', ' value=', $output);
$output = str_replace('</a></option>', '</option>', $output);
$output = str_replace('</option></option>', '</option>', $output);
$output = str_replace("</a>", "</option>\n", $output);
}
function end_el(&$output, $item, $depth = 0, $args = array()){
}
}
wp_nav_menu(array(
'theme_location' => 'primary',
'container' =>false,
'menu_class' => '',
'echo' => true,
'items_wrap' => '%3$s',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'depth' => 0,
'fallback_cb' => false,
'walker' => new Walker_Nav_Menu_Dropdown()
));
wp_nav_menu(array(
'theme_location' => 'secondary',
'container' =>false,
'menu_class' => '',
'echo' => true,
'items_wrap' => '%3$s',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'depth' => 0,
'fallback_cb' => false,
'walker' => new Walker_Nav_Menu_Dropdown(),
));
?>
</select>
</div>
</div>
<?php if (($theretailer_theme_options['shopping_bag_in_header']) && ($theretailer_theme_options['shopping_bag_in_header'] == "1")) { ?>
<?php if ( (!$theretailer_theme_options['catalog_mode']) || ($theretailer_theme_options['catalog_mode'] == 0) ) { ?>
<?php
/**
* Check if WooCommerce is active
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
?>
<!---->
<div class="gbtr_dynamic_shopping_bag">
<div class="gbtr_little_shopping_bag_wrapper
<?php if (($theretailer_theme_options['shopping_bag_style']) && ($theretailer_theme_options['shopping_bag_style'] == "style2")) { ?>
shopping_bag_mobile_style
<?php } else { ?>
shopping_bag_default_style
<?php } ?>
<?php if ((!$theretailer_theme_options['shopping_bag_in_header']) || ($theretailer_theme_options['shopping_bag_in_header'] == "1")) { ?>
shopping_bag_in_header
<?php } else{ ?>
no_shopping_bag_in_header
<?php } ?>
">
<div class="gbtr_little_shopping_bag">
<div class="title"><a href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>"><?php _e('Shopping Bag', 'theretailer'); ?></a></div>
<div class="overview"><?php echo $woocommerce->cart->get_cart_total(); ?> <span class="minicart_items">/ <?php echo $woocommerce->cart->cart_contents_count; ?> <?php _e('item(s)', 'theretailer'); ?></span></div>
<div class="gb_cart_contents_count"><?php echo $woocommerce->cart->cart_contents_count; ?></div>
</div>
<div class="gbtr_minicart_wrapper">
<div class="gbtr_minicart">
<?php
echo '<ul class="cart_list">';
if (sizeof($woocommerce->cart->cart_contents)>0) : foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) :
$_product = $cart_item['data'];
if ($_product->exists() && $cart_item['quantity']>0) :
echo '<li class="cart_list_product">';
echo '<a class="cart_list_product_img" href="'.get_permalink($cart_item['product_id']).'">' . $_product->get_image().'</a>';
echo '<div class="cart_list_product_title">';
$gbtr_product_title = $_product->get_title();
//$gbtr_short_product_title = (strlen($gbtr_product_title) > 28) ? substr($gbtr_product_title, 0, 25) . '...' : $gbtr_product_title;
echo '<a href="'.get_permalink($cart_item['product_id']).'">' . apply_filters('woocommerce_cart_widget_product_title', $gbtr_product_title, $_product) . '</a>';
echo '<div class="cart_list_product_quantity">'.__('Quantity:', 'theretailer').' '.$cart_item['quantity'].'</div>';
echo '</div>';
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">×</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove this item', 'theretailer') ), $cart_item_key );
echo '<div class="cart_list_product_price">'.woocommerce_price($_product->get_price()).'</div>';
echo '<div class="clr"></div>';
echo '</li>';
endif;
endforeach;
?>
<div class="minicart_total_checkout">
<?php _e('Cart subtotal', 'theretailer'); ?><span><?php echo $woocommerce->cart->get_cart_total(); ?></span>
</div>
<a href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" class="button gbtr_minicart_cart_but"><?php _e('View Shopping Bag', 'theretailer'); ?></a>
<a href="<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>" class="button gbtr_minicart_checkout_but"><?php _e('Proceed to Checkout', 'theretailer'); ?></a>
<?php
else: echo '<li class="empty">'.__('No products in the shopping bag.','theretailer').'</li>'; endif;
echo '</ul>';
?>
</div>
</div>
</div>
<a href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" class="gbtr_little_shopping_bag_wrapper_mobiles"><span><?php echo $woocommerce->cart->cart_contents_count; ?></span></a>
</div>
<script type="text/javascript">// <![CDATA[
jQuery(function(){
jQuery(".cart_list_product_title a").each(function(i){
len=jQuery(this).text().length;
if(len>25)
{
jQuery(this).text(jQuery(this).text().substr(0,25)+'...');
}
});
});
// ]]></script>
<!---->
<?php } ?>
<?php } ?>
<?php } ?>
<div class="clr"></div>
</div><!--/menus_wrapper-->
</div><!--/menus_envelope-->
</div><!--/grid_9-->
</div>
</div>