@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @subpackage layout |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | -if ( ! function_exists( 'lsx_wc_support' ) ) : |
|
13 | +if ( ! function_exists('lsx_wc_support')) : |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * WooCommerce support. |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | * @subpackage woocommerce |
20 | 20 | */ |
21 | 21 | function lsx_wc_support() { |
22 | - add_theme_support( 'woocommerce' ); |
|
22 | + add_theme_support('woocommerce'); |
|
23 | 23 | // add_theme_support( 'wc-product-gallery-zoom' ); |
24 | - add_theme_support( 'wc-product-gallery-lightbox' ); |
|
24 | + add_theme_support('wc-product-gallery-lightbox'); |
|
25 | 25 | // add_theme_support( 'wc-product-gallery-slider' ); |
26 | 26 | } |
27 | 27 | |
28 | - add_action( 'after_setup_theme', 'lsx_wc_support' ); |
|
28 | + add_action('after_setup_theme', 'lsx_wc_support'); |
|
29 | 29 | |
30 | 30 | endif; |
31 | 31 | |
32 | -if ( ! function_exists( 'lsx_wc_scripts_add_styles' ) ) : |
|
32 | +if ( ! function_exists('lsx_wc_scripts_add_styles')) : |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * WooCommerce enqueue styles. |
@@ -38,25 +38,25 @@ discard block |
||
38 | 38 | * @subpackage woocommerce |
39 | 39 | */ |
40 | 40 | function lsx_wc_scripts_add_styles() { |
41 | - wp_enqueue_style( 'woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce.css', array( 'lsx_main' ), LSX_VERSION ); |
|
42 | - wp_style_add_data( 'woocommerce-lsx', 'rtl', 'replace' ); |
|
41 | + wp_enqueue_style('woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce.css', array('lsx_main'), LSX_VERSION); |
|
42 | + wp_style_add_data('woocommerce-lsx', 'rtl', 'replace'); |
|
43 | 43 | |
44 | 44 | // Remove select2 added by WooCommerce |
45 | 45 | |
46 | - if ( ! is_admin() ) { |
|
47 | - wp_dequeue_style( 'select2' ); |
|
48 | - wp_deregister_style( 'select2' ); |
|
46 | + if ( ! is_admin()) { |
|
47 | + wp_dequeue_style('select2'); |
|
48 | + wp_deregister_style('select2'); |
|
49 | 49 | |
50 | - wp_dequeue_script( 'select2' ); |
|
50 | + wp_dequeue_script('select2'); |
|
51 | 51 | //wp_deregister_script( 'select2' ); |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - add_action( 'wp_enqueue_scripts', 'lsx_wc_scripts_add_styles' ); |
|
55 | + add_action('wp_enqueue_scripts', 'lsx_wc_scripts_add_styles'); |
|
56 | 56 | |
57 | 57 | endif; |
58 | 58 | |
59 | -if ( ! function_exists( 'lsx_wc_form_field_args' ) ) : |
|
59 | +if ( ! function_exists('lsx_wc_form_field_args')) : |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * WooCommerce form fields. |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | * @package lsx |
65 | 65 | * @subpackage woocommerce |
66 | 66 | */ |
67 | - function lsx_wc_form_field_args( $args, $key, $value ) { |
|
67 | + function lsx_wc_form_field_args($args, $key, $value) { |
|
68 | 68 | $args['input_class'][] = 'form-control'; |
69 | 69 | |
70 | 70 | return $args; |
71 | 71 | } |
72 | 72 | |
73 | - add_action( 'woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3 ); |
|
73 | + add_action('woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3); |
|
74 | 74 | |
75 | 75 | endif; |
76 | 76 | |
77 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_start' ) ) : |
|
77 | +if ( ! function_exists('lsx_wc_theme_wrapper_start')) : |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * WooCommerce wrapper start. |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | */ |
85 | 85 | function lsx_wc_theme_wrapper_start() { |
86 | 86 | lsx_content_wrap_before(); |
87 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
87 | + echo '<div id="primary" class="content-area ' . esc_attr(lsx_main_class()) . '">'; |
|
88 | 88 | lsx_content_before(); |
89 | 89 | echo '<main id="main" class="site-main" role="main">'; |
90 | 90 | lsx_content_top(); |
91 | 91 | } |
92 | 92 | |
93 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); |
|
94 | - add_action( 'woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start' ); |
|
93 | + remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); |
|
94 | + add_action('woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start'); |
|
95 | 95 | |
96 | 96 | endif; |
97 | 97 | |
98 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_end' ) ) : |
|
98 | +if ( ! function_exists('lsx_wc_theme_wrapper_end')) : |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * WooCommerce wrapper end. |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | lsx_content_wrap_after(); |
112 | 112 | } |
113 | 113 | |
114 | - remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); |
|
115 | - add_action( 'woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end' ); |
|
114 | + remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); |
|
115 | + add_action('woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end'); |
|
116 | 116 | |
117 | 117 | endif; |
118 | 118 | |
119 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner_plugin' ) ) : |
|
119 | +if ( ! function_exists('lsx_wc_disable_lsx_banner_plugin')) : |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Disable LSX Banners plugin in some WC pages. |
@@ -124,25 +124,25 @@ discard block |
||
124 | 124 | * @package lsx |
125 | 125 | * @subpackage woocommerce |
126 | 126 | */ |
127 | - function lsx_wc_disable_lsx_banner_plugin( $disabled ) { |
|
127 | + function lsx_wc_disable_lsx_banner_plugin($disabled) { |
|
128 | 128 | global $post; |
129 | 129 | |
130 | - if ( is_cart() || is_checkout() || is_account_page() ) { |
|
130 | + if (is_cart() || is_checkout() || is_account_page()) { |
|
131 | 131 | $disabled = true; |
132 | 132 | } |
133 | 133 | |
134 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
134 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
135 | 135 | $disabled = true; |
136 | 136 | } |
137 | 137 | |
138 | 138 | return $disabled; |
139 | 139 | } |
140 | 140 | |
141 | - add_filter( 'lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin' ); |
|
141 | + add_filter('lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin'); |
|
142 | 142 | |
143 | 143 | endif; |
144 | 144 | |
145 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner' ) ) : |
|
145 | +if ( ! function_exists('lsx_wc_disable_lsx_banner')) : |
|
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Disable LSX Banners banner in some WC pages. |
@@ -150,19 +150,19 @@ discard block |
||
150 | 150 | * @package lsx |
151 | 151 | * @subpackage woocommerce |
152 | 152 | */ |
153 | - function lsx_wc_disable_lsx_banner( $disabled ) { |
|
154 | - if ( is_shop() || is_product_category() || is_product_tag() || is_product() ) { |
|
153 | + function lsx_wc_disable_lsx_banner($disabled) { |
|
154 | + if (is_shop() || is_product_category() || is_product_tag() || is_product()) { |
|
155 | 155 | $disabled = true; |
156 | 156 | } |
157 | 157 | |
158 | 158 | return $disabled; |
159 | 159 | } |
160 | 160 | |
161 | - add_filter( 'lsx_banner_disable', 'lsx_wc_disable_lsx_banner' ); |
|
161 | + add_filter('lsx_banner_disable', 'lsx_wc_disable_lsx_banner'); |
|
162 | 162 | |
163 | 163 | endif; |
164 | 164 | |
165 | -if ( ! function_exists( 'lsx_wc_add_cart' ) ) : |
|
165 | +if ( ! function_exists('lsx_wc_add_cart')) : |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * Adds WC cart to the header. |
@@ -170,32 +170,32 @@ discard block |
||
170 | 170 | * @package lsx |
171 | 171 | * @subpackage template-tags |
172 | 172 | */ |
173 | - function lsx_wc_add_cart( $items, $args ) { |
|
174 | - $cart_menu_item_position = apply_filters( 'lsx_wc_cart_menu_item_position', 'primary' ); |
|
173 | + function lsx_wc_add_cart($items, $args) { |
|
174 | + $cart_menu_item_position = apply_filters('lsx_wc_cart_menu_item_position', 'primary'); |
|
175 | 175 | |
176 | - if ( $cart_menu_item_position === $args->theme_location ) { |
|
177 | - $customizer_option = get_theme_mod( 'lsx_header_wc_cart', false ); |
|
176 | + if ($cart_menu_item_position === $args->theme_location) { |
|
177 | + $customizer_option = get_theme_mod('lsx_header_wc_cart', false); |
|
178 | 178 | |
179 | - if ( ! empty( $customizer_option ) ) { |
|
179 | + if ( ! empty($customizer_option)) { |
|
180 | 180 | ob_start(); |
181 | - the_widget( 'WC_Widget_Cart', 'title=' ); |
|
181 | + the_widget('WC_Widget_Cart', 'title='); |
|
182 | 182 | $widget = ob_get_clean(); |
183 | 183 | |
184 | - if ( is_cart() ) { |
|
184 | + if (is_cart()) { |
|
185 | 185 | $item_class = 'current-menu-item'; |
186 | 186 | } else { |
187 | 187 | $item_class = ''; |
188 | 188 | } |
189 | 189 | |
190 | 190 | $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-cart-menu-item ' . $class; |
191 | - $item_class = apply_filters( 'lsx_wc_cart_menu_item_class', $item_class ); |
|
191 | + $item_class = apply_filters('lsx_wc_cart_menu_item_class', $item_class); |
|
192 | 192 | |
193 | 193 | $item = '<li class="' . $item_class . '">' . |
194 | - '<a title="' . esc_attr__( 'View your shopping cart', 'lsx' ) . '" href="' . esc_url( wc_get_cart_url() ) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">' . |
|
195 | - '<span class="lsx-wc-cart-amount">' . wp_kses_data( WC()->cart->get_cart_subtotal() ) . '</span>' . |
|
194 | + '<a title="' . esc_attr__('View your shopping cart', 'lsx') . '" href="' . esc_url(wc_get_cart_url()) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">' . |
|
195 | + '<span class="lsx-wc-cart-amount">' . wp_kses_data(WC()->cart->get_cart_subtotal()) . '</span>' . |
|
196 | 196 | /* Translators: %s: items quantity */ |
197 | - '<span class="lsx-wc-cart-count">' . wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx' ), WC()->cart->get_cart_contents_count() ) ) . '</span>' . |
|
198 | - ( ! empty( WC()->cart->get_cart_contents_count() ) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data( WC()->cart->get_cart_contents_count() ) . '</span>' : '' ) . |
|
197 | + '<span class="lsx-wc-cart-count">' . wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx'), WC()->cart->get_cart_contents_count())) . '</span>' . |
|
198 | + ( ! empty(WC()->cart->get_cart_contents_count()) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data(WC()->cart->get_cart_contents_count()) . '</span>' : '') . |
|
199 | 199 | '</a>' . |
200 | 200 | '<ul role="menu" class=" dropdown-menu lsx-wc-cart-sub-menu">' . |
201 | 201 | '<li>' . |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | '</ul>' . |
205 | 205 | '</li>'; |
206 | 206 | |
207 | - if ( 'top-menu' === $args->theme_location ) { |
|
207 | + if ('top-menu' === $args->theme_location) { |
|
208 | 208 | $items = $item . $items; |
209 | 209 | } else { |
210 | 210 | $items = $items . $item; |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | return $items; |
216 | 216 | } |
217 | 217 | |
218 | - add_filter( 'wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2 ); |
|
218 | + add_filter('wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2); |
|
219 | 219 | |
220 | 220 | endif; |
221 | 221 | |
222 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_before' ) ) : |
|
222 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_before')) : |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Change WC products widget wrapper (before). |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | * @package lsx |
228 | 228 | * @subpackage woocommerce |
229 | 229 | */ |
230 | - function lsx_wc_products_widget_wrapper_before( $html ) { |
|
230 | + function lsx_wc_products_widget_wrapper_before($html) { |
|
231 | 231 | $html = '<div class="lsx-woocommerce-slider lsx-woocommerce-shortcode">'; |
232 | 232 | return $html; |
233 | 233 | } |
234 | 234 | |
235 | - add_filter( 'woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15 ); |
|
235 | + add_filter('woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15); |
|
236 | 236 | |
237 | 237 | endif; |
238 | 238 | |
239 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_after' ) ) : |
|
239 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_after')) : |
|
240 | 240 | |
241 | 241 | /** |
242 | 242 | * Change WC products widget wrapper (after). |
@@ -244,16 +244,16 @@ discard block |
||
244 | 244 | * @package lsx |
245 | 245 | * @subpackage woocommerce |
246 | 246 | */ |
247 | - function lsx_wc_products_widget_wrapper_after( $html ) { |
|
247 | + function lsx_wc_products_widget_wrapper_after($html) { |
|
248 | 248 | $html = '</div>'; |
249 | 249 | return $html; |
250 | 250 | } |
251 | 251 | |
252 | - add_filter( 'woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15 ); |
|
252 | + add_filter('woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15); |
|
253 | 253 | |
254 | 254 | endif; |
255 | 255 | |
256 | -if ( ! function_exists( 'lsx_wc_reviews_widget_override' ) ) : |
|
256 | +if ( ! function_exists('lsx_wc_reviews_widget_override')) : |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Override WC ewviews widget. |
@@ -262,18 +262,18 @@ discard block |
||
262 | 262 | * @subpackage woocommerce |
263 | 263 | */ |
264 | 264 | function lsx_wc_reviews_widget_override() { |
265 | - if ( class_exists( 'WC_Widget_Recent_Reviews' ) ) { |
|
266 | - unregister_widget( 'WC_Widget_Recent_Reviews' ); |
|
265 | + if (class_exists('WC_Widget_Recent_Reviews')) { |
|
266 | + unregister_widget('WC_Widget_Recent_Reviews'); |
|
267 | 267 | require get_template_directory() . '/includes/classes/class-lsx-wc-widget-recent-reviews.php'; |
268 | - register_widget( 'LSX_WC_Widget_Recent_Reviews' ); |
|
268 | + register_widget('LSX_WC_Widget_Recent_Reviews'); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | - add_action( 'widgets_init', 'lsx_wc_reviews_widget_override', 15 ); |
|
272 | + add_action('widgets_init', 'lsx_wc_reviews_widget_override', 15); |
|
273 | 273 | |
274 | 274 | endif; |
275 | 275 | |
276 | -if ( ! function_exists( 'lsx_wc_change_price_html' ) ) : |
|
276 | +if ( ! function_exists('lsx_wc_change_price_html')) : |
|
277 | 277 | |
278 | 278 | /** |
279 | 279 | * Change WC ZERO price to "free". |
@@ -281,28 +281,28 @@ discard block |
||
281 | 281 | * @package lsx |
282 | 282 | * @subpackage woocommerce |
283 | 283 | */ |
284 | - function lsx_wc_change_price_html( $price, $product ) { |
|
285 | - if ( empty( $product->get_price() ) ) { |
|
286 | - if ( $product->is_on_sale() && $product->get_regular_price() ) { |
|
287 | - $regular_price = wc_get_price_to_display( $product, array( |
|
284 | + function lsx_wc_change_price_html($price, $product) { |
|
285 | + if (empty($product->get_price())) { |
|
286 | + if ($product->is_on_sale() && $product->get_regular_price()) { |
|
287 | + $regular_price = wc_get_price_to_display($product, array( |
|
288 | 288 | 'qty' => 1, |
289 | 289 | 'price' => $product->get_regular_price(), |
290 | - ) ); |
|
290 | + )); |
|
291 | 291 | |
292 | - $price = wc_format_price_range( $regular_price, esc_html__( 'Free!', 'lsx' ) ); |
|
292 | + $price = wc_format_price_range($regular_price, esc_html__('Free!', 'lsx')); |
|
293 | 293 | } else { |
294 | - $price = '<span class="amount">' . esc_html__( 'Free!', 'lsx' ) . '</span>'; |
|
294 | + $price = '<span class="amount">' . esc_html__('Free!', 'lsx') . '</span>'; |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | 298 | return $price; |
299 | 299 | } |
300 | 300 | |
301 | - add_filter( 'woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2 ); |
|
301 | + add_filter('woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2); |
|
302 | 302 | |
303 | 303 | endif; |
304 | 304 | |
305 | -if ( ! function_exists( 'lsx_wc_cart_link_fragment' ) ) : |
|
305 | +if ( ! function_exists('lsx_wc_cart_link_fragment')) : |
|
306 | 306 | |
307 | 307 | /** |
308 | 308 | * Cart Fragments. |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @package lsx |
312 | 312 | * @subpackage woocommerce |
313 | 313 | */ |
314 | - function lsx_wc_cart_link_fragment( $fragments ) { |
|
314 | + function lsx_wc_cart_link_fragment($fragments) { |
|
315 | 315 | global $woocommerce; |
316 | 316 | |
317 | 317 | ob_start(); |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | lsx_wc_items_counter(); |
323 | 323 | $items_counter = ob_get_clean(); |
324 | 324 | |
325 | - if ( ! empty( $items_counter ) ) { |
|
326 | - $fragments['div.widget_shopping_cart_content'] = preg_replace( '/(.+)(<\/ul>)[\s\n]*(<p class="woocommerce-mini-cart__total)(.+)/', '$1' . $items_counter . '$2$3$4', $fragments['div.widget_shopping_cart_content'] ); |
|
325 | + if ( ! empty($items_counter)) { |
|
326 | + $fragments['div.widget_shopping_cart_content'] = preg_replace('/(.+)(<\/ul>)[\s\n]*(<p class="woocommerce-mini-cart__total)(.+)/', '$1' . $items_counter . '$2$3$4', $fragments['div.widget_shopping_cart_content']); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | return $fragments; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | endif; |
333 | 333 | |
334 | -if ( ! function_exists( 'lsx_wc_cart_link' ) ) : |
|
334 | +if ( ! function_exists('lsx_wc_cart_link')) : |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * Cart Link. |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function lsx_wc_cart_link() { |
344 | 344 | ?> |
345 | - <a title="<?php esc_attr_e( 'View your shopping cart', 'lsx' ); ?>" href="<?php echo esc_url( wc_get_cart_url() ); ?>" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"> |
|
346 | - <span class="lsx-wc-cart-amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> |
|
345 | + <a title="<?php esc_attr_e('View your shopping cart', 'lsx'); ?>" href="<?php echo esc_url(wc_get_cart_url()); ?>" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"> |
|
346 | + <span class="lsx-wc-cart-amount"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span> |
|
347 | 347 | |
348 | 348 | <?php /* Translators: %s: items quantity */ ?> |
349 | - <span class="lsx-wc-cart-count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx' ), WC()->cart->get_cart_contents_count() ) );?></span> |
|
349 | + <span class="lsx-wc-cart-count"><?php echo wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx'), WC()->cart->get_cart_contents_count())); ?></span> |
|
350 | 350 | |
351 | - <?php if ( ! empty( WC()->cart->get_cart_contents_count() ) ) : ?> |
|
352 | - <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() );?></span> |
|
351 | + <?php if ( ! empty(WC()->cart->get_cart_contents_count())) : ?> |
|
352 | + <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data(WC()->cart->get_cart_contents_count()); ?></span> |
|
353 | 353 | <?php endif; ?> |
354 | 354 | </a> |
355 | 355 | <?php |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | endif; |
359 | 359 | |
360 | -if ( ! function_exists( 'lsx_wc_items_counter' ) ) : |
|
360 | +if ( ! function_exists('lsx_wc_items_counter')) : |
|
361 | 361 | |
362 | 362 | /** |
363 | 363 | * Add car item hidden items counter. |
@@ -369,21 +369,21 @@ discard block |
||
369 | 369 | $count = (int) WC()->cart->get_cart_contents_count(); |
370 | 370 | $items_counter = ''; |
371 | 371 | |
372 | - if ( ! empty( $count ) ) { |
|
372 | + if ( ! empty($count)) { |
|
373 | 373 | $count -= 3; |
374 | 374 | |
375 | - if ( 1 === $count ) { |
|
376 | - $items_counter = esc_html__( '1 other item in cart', 'lsx' ); |
|
377 | - } elseif ( $count > 1 ) { |
|
375 | + if (1 === $count) { |
|
376 | + $items_counter = esc_html__('1 other item in cart', 'lsx'); |
|
377 | + } elseif ($count > 1) { |
|
378 | 378 | /* Translators: %s: items counter */ |
379 | - $items_counter = sprintf( esc_html__( '%s other items in cart', 'lsx' ), $count ); |
|
379 | + $items_counter = sprintf(esc_html__('%s other items in cart', 'lsx'), $count); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( ! empty( $items_counter ) ) : |
|
383 | + if ( ! empty($items_counter)) : |
|
384 | 384 | ?> |
385 | 385 | <li class="woocommerce-mini-cart-item mini_cart_item" style="display: block;"> |
386 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>"><?php echo esc_html( $items_counter ); ?></a> |
|
386 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>"><?php echo esc_html($items_counter); ?></a> |
|
387 | 387 | </li> |
388 | 388 | <?php |
389 | 389 | endif; |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | endif; |
393 | 393 | |
394 | -if ( ! function_exists( 'lsx_wc_loop_shop_per_page' ) ) : |
|
394 | +if ( ! function_exists('lsx_wc_loop_shop_per_page')) : |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Changes the number of products to display on shop. |
@@ -399,16 +399,16 @@ discard block |
||
399 | 399 | * @package lsx |
400 | 400 | * @subpackage woocommerce |
401 | 401 | */ |
402 | - function lsx_wc_loop_shop_per_page( $items ) { |
|
402 | + function lsx_wc_loop_shop_per_page($items) { |
|
403 | 403 | $items = 20; |
404 | 404 | return $items; |
405 | 405 | } |
406 | 406 | |
407 | - add_filter( 'loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20 ); |
|
407 | + add_filter('loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20); |
|
408 | 408 | |
409 | 409 | endif; |
410 | 410 | |
411 | -if ( ! function_exists( 'lsx_wc_add_to_cart_message_html' ) ) : |
|
411 | +if ( ! function_exists('lsx_wc_add_to_cart_message_html')) : |
|
412 | 412 | |
413 | 413 | /** |
414 | 414 | * Changes the "added to cart" message HTML. |
@@ -416,39 +416,39 @@ discard block |
||
416 | 416 | * @package lsx |
417 | 417 | * @subpackage woocommerce |
418 | 418 | */ |
419 | - function lsx_wc_add_to_cart_message_html( $message, $products ) { |
|
419 | + function lsx_wc_add_to_cart_message_html($message, $products) { |
|
420 | 420 | $message = '<div class="woocommerce-message-added-to-cart">' . $message . '</div>'; |
421 | 421 | return $message; |
422 | 422 | } |
423 | 423 | |
424 | - add_filter( 'wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2 ); |
|
424 | + add_filter('wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2); |
|
425 | 425 | |
426 | 426 | endif; |
427 | 427 | |
428 | -if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) { |
|
429 | - add_filter( 'woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
428 | +if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.3', '>=')) { |
|
429 | + add_filter('woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
430 | 430 | } else { |
431 | - add_filter( 'add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
431 | + add_filter('add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
432 | 432 | } |
433 | 433 | |
434 | -remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
434 | +remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
435 | 435 | |
436 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
437 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
438 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
439 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
440 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
436 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
437 | +add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
438 | +add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
439 | +add_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
440 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
441 | 441 | |
442 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
443 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
442 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
443 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
444 | 444 | |
445 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
446 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
447 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
448 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
449 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
445 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
446 | +add_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
447 | +add_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
448 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
449 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
450 | 450 | |
451 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper' ) ) : |
|
451 | +if ( ! function_exists('lsx_wc_sorting_wrapper')) : |
|
452 | 452 | |
453 | 453 | /** |
454 | 454 | * Sorting wrapper. |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | endif; |
464 | 464 | |
465 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper_close' ) ) : |
|
465 | +if ( ! function_exists('lsx_wc_sorting_wrapper_close')) : |
|
466 | 466 | |
467 | 467 | /** |
468 | 468 | * Sorting wrapper close. |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | |
477 | 477 | endif; |
478 | 478 | |
479 | -if ( ! function_exists( 'lsx_wc_product_columns_wrapper_close' ) ) : |
|
479 | +if ( ! function_exists('lsx_wc_product_columns_wrapper_close')) : |
|
480 | 480 | |
481 | 481 | /** |
482 | 482 | * Product columns wrapper close. |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | endif; |
492 | 492 | |
493 | -if ( ! function_exists( 'lsx_wc_woocommerce_pagination' ) ) : |
|
493 | +if ( ! function_exists('lsx_wc_woocommerce_pagination')) : |
|
494 | 494 | |
495 | 495 | /** |
496 | 496 | * LSX WooCommerce Pagination |
@@ -502,14 +502,14 @@ discard block |
||
502 | 502 | * @subpackage woocommerce |
503 | 503 | */ |
504 | 504 | function lsx_wc_woocommerce_pagination() { |
505 | - if ( woocommerce_products_will_display() ) { |
|
505 | + if (woocommerce_products_will_display()) { |
|
506 | 506 | woocommerce_pagination(); |
507 | 507 | } |
508 | 508 | } |
509 | 509 | |
510 | 510 | endif; |
511 | 511 | |
512 | -if ( ! function_exists( 'lsx_customizer_wc_controls' ) ) : |
|
512 | +if ( ! function_exists('lsx_customizer_wc_controls')) : |
|
513 | 513 | |
514 | 514 | /** |
515 | 515 | * Returns an array of the core panel. |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @return $lsx_controls array() |
521 | 521 | */ |
522 | - function lsx_customizer_wc_controls( $lsx_controls ) { |
|
522 | + function lsx_customizer_wc_controls($lsx_controls) { |
|
523 | 523 | $lsx_controls['panels']['lsx-wc'] = array( |
524 | - 'title' => esc_html__( 'WooCommerce', 'lsx' ), |
|
525 | - 'description' => esc_html__( 'Change the WooCommerce settings.', 'lsx' ), |
|
524 | + 'title' => esc_html__('WooCommerce', 'lsx'), |
|
525 | + 'description' => esc_html__('Change the WooCommerce settings.', 'lsx'), |
|
526 | 526 | 'priority' => 23, |
527 | 527 | ); |
528 | 528 | |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | */ |
532 | 532 | |
533 | 533 | $lsx_controls['sections']['lsx-wc-global'] = array( |
534 | - 'title' => esc_html__( 'Global', 'lsx' ), |
|
535 | - 'description' => esc_html__( 'Change the WooCommerce global settings.', 'lsx' ), |
|
534 | + 'title' => esc_html__('Global', 'lsx'), |
|
535 | + 'description' => esc_html__('Change the WooCommerce global settings.', 'lsx'), |
|
536 | 536 | 'panel' => 'lsx-wc', |
537 | 537 | 'priority' => 1, |
538 | 538 | ); |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | ); |
544 | 544 | |
545 | 545 | $lsx_controls['fields']['lsx_wc_mobile_footer_bar_status'] = array( |
546 | - 'label' => esc_html__( 'Footer Bar', 'lsx' ), |
|
547 | - 'description' => esc_html__( 'Enable the mobile footer bar.', 'lsx' ), |
|
546 | + 'label' => esc_html__('Footer Bar', 'lsx'), |
|
547 | + 'description' => esc_html__('Enable the mobile footer bar.', 'lsx'), |
|
548 | 548 | 'section' => 'lsx-wc-global', |
549 | 549 | 'type' => 'checkbox', |
550 | 550 | 'priority' => 1, |
@@ -555,8 +555,8 @@ discard block |
||
555 | 555 | */ |
556 | 556 | |
557 | 557 | $lsx_controls['sections']['lsx-wc-cart'] = array( |
558 | - 'title' => esc_html__( 'Cart', 'lsx' ), |
|
559 | - 'description' => esc_html__( 'Change the WooCommerce cart settings.', 'lsx' ), |
|
558 | + 'title' => esc_html__('Cart', 'lsx'), |
|
559 | + 'description' => esc_html__('Change the WooCommerce cart settings.', 'lsx'), |
|
560 | 560 | 'panel' => 'lsx-wc', |
561 | 561 | 'priority' => 2, |
562 | 562 | ); |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | ); |
568 | 568 | |
569 | 569 | $lsx_controls['fields']['lsx_header_wc_cart'] = array( |
570 | - 'label' => esc_html__( 'Menu Item', 'lsx' ), |
|
571 | - 'description' => esc_html__( 'Enable the cart menu item.', 'lsx' ), |
|
570 | + 'label' => esc_html__('Menu Item', 'lsx'), |
|
571 | + 'description' => esc_html__('Enable the cart menu item.', 'lsx'), |
|
572 | 572 | 'section' => 'lsx-wc-cart', |
573 | 573 | 'type' => 'checkbox', |
574 | 574 | 'priority' => 1, |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | |
580 | 580 | endif; |
581 | 581 | |
582 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_wc_controls' ); |
|
582 | +add_filter('lsx_customizer_controls', 'lsx_customizer_wc_controls'); |
|
583 | 583 | |
584 | -if ( ! function_exists( 'lsx_wc_footer_bar' ) ) : |
|
584 | +if ( ! function_exists('lsx_wc_footer_bar')) : |
|
585 | 585 | |
586 | 586 | /** |
587 | 587 | * Display WC footer bar. |
@@ -590,46 +590,46 @@ discard block |
||
590 | 590 | * @subpackage woocommerce |
591 | 591 | */ |
592 | 592 | function lsx_wc_footer_bar() { |
593 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) : |
|
593 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) : |
|
594 | 594 | ?> |
595 | 595 | <div class="lsx-wc-footer-bar"> |
596 | - <form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-form"> |
|
596 | + <form role="search" method="get" action="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-form"> |
|
597 | 597 | <fieldset> |
598 | - <legend class="screen-reader-text"><?php esc_html_e( 'Search products', 'lsx' ); ?></legend> |
|
599 | - <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search products…', 'lsx' ); ?>" class="form-control"> |
|
598 | + <legend class="screen-reader-text"><?php esc_html_e('Search products', 'lsx'); ?></legend> |
|
599 | + <input type="search" name="s" placeholder="<?php esc_attr_e('Search products…', 'lsx'); ?>" class="form-control"> |
|
600 | 600 | </fieldset> |
601 | 601 | </form> |
602 | 602 | |
603 | 603 | <ul class="lsx-wc-footer-bar-items"> |
604 | 604 | <li class="lsx-wc-footer-bar-item"> |
605 | - <a href="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
605 | + <a href="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
606 | 606 | <i class="fa fa-home" aria-hidden="true"></i> |
607 | - <span><?php esc_html_e( 'Home', 'lsx' ); ?></span> |
|
607 | + <span><?php esc_html_e('Home', 'lsx'); ?></span> |
|
608 | 608 | </a> |
609 | 609 | </li> |
610 | 610 | |
611 | 611 | <li class="lsx-wc-footer-bar-item"> |
612 | - <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>" class="lsx-wc-footer-bar-link"> |
|
612 | + <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="lsx-wc-footer-bar-link"> |
|
613 | 613 | <i class="fa fa-user" aria-hidden="true"></i> |
614 | - <span><?php esc_html_e( 'Account', 'lsx' ); ?></span> |
|
614 | + <span><?php esc_html_e('Account', 'lsx'); ?></span> |
|
615 | 615 | </a> |
616 | 616 | </li> |
617 | 617 | |
618 | 618 | <li class="lsx-wc-footer-bar-item"> |
619 | 619 | <a href="#" class="lsx-wc-footer-bar-link lsx-wc-footer-bar-link-toogle"> |
620 | 620 | <i class="fa fa-search" aria-hidden="true"></i> |
621 | - <span><?php esc_html_e( 'Search', 'lsx' ); ?></span> |
|
621 | + <span><?php esc_html_e('Search', 'lsx'); ?></span> |
|
622 | 622 | </a> |
623 | 623 | </li> |
624 | 624 | |
625 | 625 | <li class="lsx-wc-footer-bar-item"> |
626 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
626 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
627 | 627 | <i class="fa fa-shopping-basket" aria-hidden="true"></i> |
628 | 628 | <?php $count = WC()->cart->get_cart_contents_count(); ?> |
629 | - <?php if ( ! empty( $count ) ) : ?> |
|
630 | - <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data( $count ); ?></span> |
|
629 | + <?php if ( ! empty($count)) : ?> |
|
630 | + <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data($count); ?></span> |
|
631 | 631 | <?php endif; ?> |
632 | - <span><?php esc_html_e( 'Cart', 'lsx' ); ?></span> |
|
632 | + <span><?php esc_html_e('Cart', 'lsx'); ?></span> |
|
633 | 633 | </a> |
634 | 634 | </li> |
635 | 635 | </ul> |
@@ -638,11 +638,11 @@ discard block |
||
638 | 638 | endif; |
639 | 639 | } |
640 | 640 | |
641 | - add_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
641 | + add_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
642 | 642 | |
643 | 643 | endif; |
644 | 644 | |
645 | -if ( ! function_exists( 'lsx_wc_body_class' ) ) : |
|
645 | +if ( ! function_exists('lsx_wc_body_class')) : |
|
646 | 646 | |
647 | 647 | /** |
648 | 648 | * Changes body class. |
@@ -650,21 +650,21 @@ discard block |
||
650 | 650 | * @package lsx |
651 | 651 | * @subpackage woocommerce |
652 | 652 | */ |
653 | - function lsx_wc_body_class( $classes ) { |
|
653 | + function lsx_wc_body_class($classes) { |
|
654 | 654 | global $post; |
655 | 655 | |
656 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
656 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
657 | 657 | $classes[] = 'woocommerce-page woocommerce-wishlist'; |
658 | 658 | } |
659 | 659 | |
660 | 660 | return $classes; |
661 | 661 | } |
662 | 662 | |
663 | - add_filter( 'body_class', 'lsx_wc_body_class', 2999 ); |
|
663 | + add_filter('body_class', 'lsx_wc_body_class', 2999); |
|
664 | 664 | |
665 | 665 | endif; |
666 | 666 | |
667 | -if ( ! function_exists( 'lsx_wc_downloadable_products' ) ) : |
|
667 | +if ( ! function_exists('lsx_wc_downloadable_products')) : |
|
668 | 668 | |
669 | 669 | /** |
670 | 670 | * Changes downloads "download" button text. |
@@ -672,14 +672,14 @@ discard block |
||
672 | 672 | * @package lsx |
673 | 673 | * @subpackage woocommerce |
674 | 674 | */ |
675 | - function lsx_wc_downloadable_products( $downloads ) { |
|
676 | - foreach ( $downloads as $i => $download ) { |
|
677 | - $downloads[ $i ]['download_name'] = esc_html__( 'Download', 'lsx' ); |
|
675 | + function lsx_wc_downloadable_products($downloads) { |
|
676 | + foreach ($downloads as $i => $download) { |
|
677 | + $downloads[$i]['download_name'] = esc_html__('Download', 'lsx'); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | return $downloads; |
681 | 681 | } |
682 | 682 | |
683 | - add_filter( 'woocommerce_customer_get_downloadable_products', 'lsx_wc_downloadable_products', 2999 ); |
|
683 | + add_filter('woocommerce_customer_get_downloadable_products', 'lsx_wc_downloadable_products', 2999); |
|
684 | 684 | |
685 | 685 | endif; |