@@ -1,365 +1,365 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_WooCommerce' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer WooCommerce Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_WooCommerce extends LSX_Customizer { |
|
14 | - |
|
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.1.1 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
22 | - |
|
23 | - add_filter( 'body_class', array( $this, 'body_class' ), 2999 ); |
|
24 | - |
|
25 | - add_action( 'template_redirect', array( $this, 'thankyou_page' ), 2999 ); |
|
26 | - |
|
27 | - if ( empty( get_theme_mod( 'lsx_two_step_checkout', false ) ) ) { |
|
28 | - add_action( 'lsx_entry_inside_top', array( $this, 'checkout_steps' ), 15 ); |
|
29 | - } |
|
30 | - |
|
31 | - add_action( 'wp', array( $this, 'cart_extra_html' ), 2999 ); |
|
32 | - add_action( 'wp', array( $this, 'checkout_extra_html' ), 2999 ); |
|
33 | - add_action( 'lsx_wc_cart_menu_item_position', array( $this, 'cart_menu_item_position' ) ); |
|
34 | - add_action( 'lsx_wc_cart_menu_item_class', array( $this, 'cart_menu_item_class' ) ); |
|
35 | - |
|
36 | - add_filter( 'wp_nav_menu_items', array( $this, 'my_account_menu_item' ), 9, 2 ); |
|
37 | - add_action( 'lsx_wc_my_account_menu_item_position', array( $this, 'my_account_menu_item_position' ) ); |
|
38 | - add_action( 'lsx_wc_my_account_menu_item_class', array( $this, 'my_account_menu_item_class' ) ); |
|
39 | - |
|
40 | - // Shop Layout Switcher. |
|
41 | - //add_action( 'wp_head', array( $this, 'show_layout_switcher' ), 1 ); |
|
42 | - //add_filter( 'gridlist_toggle_button_output', array( $this, 'gridlist_toggle_button_output' ), 10, 3 ); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Customizer Controls and Settings. |
|
47 | - * |
|
48 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
49 | - * @since 1.1.1 |
|
50 | - */ |
|
51 | - public function customize_register( $wp_customize ) { |
|
52 | - /** |
|
53 | - * Checkout. |
|
54 | - */ |
|
55 | - |
|
56 | - $wp_customize->add_section( 'lsx-wc-checkout', array( |
|
57 | - 'title' => esc_html__( 'LSX Checkout', 'lsx-customizer' ), |
|
58 | - 'description' => esc_html__( 'Change the WooCommerce checkout settings.', 'lsx-customizer' ), |
|
59 | - 'panel' => 'woocommerce', |
|
60 | - 'priority' => 3, |
|
61 | - ) ); |
|
62 | - |
|
63 | - $wp_customize->add_setting( 'lsx_checkout_steps', array( |
|
64 | - 'default' => true, |
|
65 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
66 | - ) ); |
|
67 | - |
|
68 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_checkout_steps', array( |
|
69 | - 'label' => esc_html__( 'Steps', 'lsx-customizer' ), |
|
70 | - 'description' => esc_html__( 'Enable the checkout steps header.', 'lsx-customizer' ), |
|
71 | - 'section' => 'lsx-wc-checkout', |
|
72 | - 'settings' => 'lsx_checkout_steps', |
|
73 | - 'type' => 'checkbox', |
|
74 | - 'priority' => 1, |
|
75 | - ) ) ); |
|
76 | - |
|
77 | - /** |
|
78 | - * Checkout Layout |
|
79 | - */ |
|
80 | - $wp_customize->add_setting( 'lsx_wc_checkout_layout', array( |
|
81 | - 'default' => 'default', |
|
82 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
83 | - ) ); |
|
84 | - |
|
85 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_checkout_layout', array( |
|
86 | - 'label' => esc_html__( 'Layout', 'lsx-customizer' ), |
|
87 | - 'description' => esc_html__( 'WooCommerce checkout layout.', 'lsx-customizer' ), |
|
88 | - 'section' => 'lsx-wc-checkout', |
|
89 | - 'settings' => 'lsx_wc_checkout_layout', |
|
90 | - 'type' => 'select', |
|
91 | - 'priority' => 2, |
|
92 | - 'choices' => array( |
|
93 | - 'default' => esc_html__( 'Default', 'lsx-customizer' ), |
|
94 | - 'stacked' => esc_html__( 'Stacked', 'lsx-customizer' ), |
|
95 | - 'columns' => esc_html__( 'Columns', 'lsx-customizer' ), |
|
96 | - ), |
|
97 | - ) ) ); |
|
98 | - |
|
99 | - $wp_customize->add_setting( 'lsx_wc_checkout_thankyou_page', array( |
|
100 | - 'default' => '0', |
|
101 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
102 | - ) ); |
|
103 | - |
|
104 | - $choices = array( |
|
105 | - '0' => esc_html__( 'Default', 'lsx-customizer' ), |
|
106 | - ); |
|
107 | - |
|
108 | - /** |
|
109 | - * Distraction Free Checkout |
|
110 | - */ |
|
111 | - $wp_customize->add_setting( 'lsx_distraction_free_checkout', array( |
|
112 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
113 | - ) ); |
|
114 | - |
|
115 | - $wp_customize->add_control( new WP_Customize_Control( |
|
116 | - $wp_customize, |
|
117 | - 'lsx_distraction_free_checkout', |
|
118 | - array( |
|
119 | - 'label' => esc_html__( 'Distraction Free Checkout', 'lsx-customizer' ), |
|
120 | - 'description' => esc_html__( 'Removes all clutter from the checkout, allowing the customer to focus entirely on that procedure. Removes the stepped cart and checkout.', 'lsx-customizer' ), |
|
121 | - 'section' => 'lsx-wc-checkout', |
|
122 | - 'settings' => 'lsx_distraction_free_checkout', |
|
123 | - 'type' => 'checkbox', |
|
124 | - 'priority' => 3, |
|
125 | - ) |
|
126 | - ) ); |
|
127 | - |
|
128 | - /** |
|
129 | - * Two Step Checkout |
|
130 | - */ |
|
131 | - $wp_customize->add_setting( 'lsx_two_step_checkout', array( |
|
132 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
133 | - ) ); |
|
134 | - |
|
135 | - $wp_customize->add_control( new WP_Customize_Control( |
|
136 | - $wp_customize, |
|
137 | - 'lsx_two_step_checkout', |
|
138 | - array( |
|
139 | - 'label' => esc_html__( 'Two Step Checkout', 'lsx-customizer' ), |
|
140 | - 'description' => esc_html__( 'Separates the customer details collection form, and the order summary / payment details form in to two separate pages. Removes the stepped cart and checkout.', 'lsx-customizer' ), |
|
141 | - 'section' => 'lsx-wc-checkout', |
|
142 | - 'settings' => 'lsx_two_step_checkout', |
|
143 | - 'type' => 'checkbox', |
|
144 | - 'priority' => 4, |
|
145 | - ) |
|
146 | - ) ); |
|
147 | - |
|
148 | - /** |
|
149 | - * Thank you page options |
|
150 | - */ |
|
151 | - $pages = get_pages(); |
|
152 | - |
|
153 | - foreach ( $pages as $key => $page ) { |
|
154 | - $choices[ $page->ID ] = $page->post_title; |
|
155 | - } |
|
156 | - |
|
157 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_checkout_thankyou_page', array( |
|
158 | - 'label' => esc_html__( 'Thank You Page', 'lsx-customizer' ), |
|
159 | - 'description' => esc_html__( 'WooCommerce checkout thank you page.', 'lsx-customizer' ), |
|
160 | - 'section' => 'lsx-wc-checkout', |
|
161 | - 'settings' => 'lsx_wc_checkout_thankyou_page', |
|
162 | - 'type' => 'select', |
|
163 | - 'priority' => 5, |
|
164 | - 'choices' => $choices, |
|
165 | - ) ) ); |
|
166 | - |
|
167 | - $wp_customize->add_setting( 'lsx_wc_checkout_extra_html', array( |
|
168 | - 'default' => '', |
|
169 | - 'sanitize_callback' => 'wp_kses_post', |
|
170 | - ) ); |
|
171 | - |
|
172 | - $wp_customize->add_control( new LSX_Customizer_Wysiwyg_Control( $wp_customize, 'lsx_wc_checkout_extra_html', array( |
|
173 | - 'label' => esc_html__( 'Extra HTML', 'lsx-customizer' ), |
|
174 | - 'description' => esc_html__( 'Extra HTML to display at checkout page (bottom/right).', 'lsx-customizer' ), |
|
175 | - 'section' => 'lsx-wc-checkout', |
|
176 | - 'settings' => 'lsx_wc_checkout_extra_html', |
|
177 | - 'priority' => 6, |
|
178 | - 'type' => 'wysiwyg', |
|
179 | - ) ) ); |
|
180 | - |
|
181 | - /** |
|
182 | - * Cart. |
|
183 | - */ |
|
184 | - |
|
185 | - $wp_customize->add_setting( 'lsx_wc_cart_menu_item_style', array( |
|
186 | - 'default' => 'extended', |
|
187 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
188 | - ) ); |
|
189 | - |
|
190 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_cart_menu_item_style', array( |
|
191 | - 'label' => esc_html__( 'Menu Item Style', 'lsx-customizer' ), |
|
192 | - 'description' => esc_html__( 'WooCommerce menu item cart style.', 'lsx-customizer' ), |
|
193 | - 'section' => 'lsx-wc-cart', |
|
194 | - 'settings' => 'lsx_wc_cart_menu_item_style', |
|
195 | - 'type' => 'select', |
|
196 | - 'priority' => 2, |
|
197 | - 'choices' => array( |
|
198 | - 'simple' => esc_html__( 'Simple', 'lsx-customizer' ), |
|
199 | - 'extended' => esc_html__( 'Extended', 'lsx-customizer' ), |
|
200 | - ), |
|
201 | - ) ) ); |
|
202 | - |
|
203 | - $wp_customize->add_setting( 'lsx_wc_cart_menu_item_position', array( |
|
204 | - 'default' => 'main-menu-in', |
|
205 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
206 | - ) ); |
|
207 | - |
|
208 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_cart_menu_item_position', array( |
|
209 | - 'label' => esc_html__( 'Menu Item Position', 'lsx-customizer' ), |
|
210 | - 'description' => esc_html__( 'WooCommerce menu item cart position.', 'lsx-customizer' ), |
|
211 | - 'section' => 'lsx-wc-cart', |
|
212 | - 'settings' => 'lsx_wc_cart_menu_item_position', |
|
213 | - 'type' => 'select', |
|
214 | - 'priority' => 3, |
|
215 | - 'choices' => array( |
|
216 | - 'main-menu-in' => esc_html__( 'Main Menu (as last item)', 'lsx-customizer' ), |
|
217 | - 'main-menu-out' => esc_html__( 'Main Menu (as last item, right aligned)', 'lsx-customizer' ), |
|
218 | - 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx-customizer' ), |
|
219 | - 'top-menu-right' => esc_html__( 'Top Menu (right)', 'lsx-customizer' ), |
|
220 | - ), |
|
221 | - ) ) ); |
|
222 | - |
|
223 | - $wp_customize->add_setting( 'lsx_wc_cart_extra_html', array( |
|
224 | - 'default' => '', |
|
225 | - 'sanitize_callback' => 'wp_kses_post', |
|
226 | - ) ); |
|
227 | - |
|
228 | - $wp_customize->add_control( new LSX_Customizer_Wysiwyg_Control( $wp_customize, 'lsx_wc_cart_extra_html', array( |
|
229 | - 'label' => esc_html__( 'Extra HTML', 'lsx-customizer' ), |
|
230 | - 'description' => esc_html__( 'Extra HTML to display at cart page (bottom/left).', 'lsx-customizer' ), |
|
231 | - 'section' => 'lsx-wc-cart', |
|
232 | - 'settings' => 'lsx_wc_cart_extra_html', |
|
233 | - 'priority' => 4, |
|
234 | - 'type' => 'wysiwyg', |
|
235 | - ) ) ); |
|
236 | - |
|
237 | - /** |
|
238 | - * My Account. |
|
239 | - */ |
|
240 | - |
|
241 | - $wp_customize->add_section( 'lsx-wc-my-account', array( |
|
242 | - 'title' => esc_html__( 'LSX My Account', 'lsx-customizer' ), |
|
243 | - 'description' => esc_html__( 'Change the WooCommerce My Account settings.', 'lsx-customizer' ), |
|
244 | - 'panel' => 'woocommerce', |
|
245 | - 'priority' => 4, |
|
246 | - ) ); |
|
247 | - |
|
248 | - $wp_customize->add_setting( 'lsx_wc_my_account_menu_item', array( |
|
249 | - 'default' => false, |
|
250 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
251 | - ) ); |
|
252 | - |
|
253 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item', array( |
|
254 | - 'label' => esc_html__( 'Menu Item', 'lsx-customizer' ), |
|
255 | - 'description' => esc_html__( 'Enable the My Account menu item.', 'lsx-customizer' ), |
|
256 | - 'section' => 'lsx-wc-my-account', |
|
257 | - 'settings' => 'lsx_wc_my_account_menu_item', |
|
258 | - 'type' => 'checkbox', |
|
259 | - 'priority' => 1, |
|
260 | - ) ) ); |
|
261 | - |
|
262 | - $wp_customize->add_setting( 'lsx_wc_my_account_menu_item_style', array( |
|
263 | - 'default' => 'extended', |
|
264 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
265 | - ) ); |
|
266 | - |
|
267 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item_style', array( |
|
268 | - 'label' => esc_html__( 'Menu Item Style', 'lsx-customizer' ), |
|
269 | - 'description' => esc_html__( 'WooCommerce menu item My Account style.', 'lsx-customizer' ), |
|
270 | - 'section' => 'lsx-wc-my-account', |
|
271 | - 'settings' => 'lsx_wc_my_account_menu_item_style', |
|
272 | - 'type' => 'select', |
|
273 | - 'priority' => 2, |
|
274 | - 'choices' => array( |
|
275 | - 'simple' => esc_html__( 'Simple', 'lsx-customizer' ), |
|
276 | - 'extended' => esc_html__( 'Extended', 'lsx-customizer' ), |
|
277 | - ), |
|
278 | - ) ) ); |
|
279 | - |
|
280 | - $wp_customize->add_setting( 'lsx_wc_my_account_menu_item_position', array( |
|
281 | - 'default' => 'main-menu-in', |
|
282 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
283 | - ) ); |
|
284 | - |
|
285 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item_position', array( |
|
286 | - 'label' => esc_html__( 'Menu Item Position', 'lsx-customizer' ), |
|
287 | - 'description' => esc_html__( 'WooCommerce menu item My Account position.', 'lsx-customizer' ), |
|
288 | - 'section' => 'lsx-wc-my-account', |
|
289 | - 'settings' => 'lsx_wc_my_account_menu_item_position', |
|
290 | - 'type' => 'select', |
|
291 | - 'priority' => 3, |
|
292 | - 'choices' => array( |
|
293 | - 'main-menu-in' => esc_html__( 'Main Menu (as last item)', 'lsx-customizer' ), |
|
294 | - 'main-menu-out' => esc_html__( 'Main Menu (as last item, right aligned)', 'lsx-customizer' ), |
|
295 | - 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx-customizer' ), |
|
296 | - 'top-menu-right' => esc_html__( 'Top Menu (right)', 'lsx-customizer' ), |
|
297 | - ), |
|
298 | - ) ) ); |
|
299 | - } |
|
300 | - |
|
301 | - /** |
|
302 | - * Add and remove WC body_class() classes. |
|
303 | - * |
|
304 | - * @since 1.1.1 |
|
305 | - */ |
|
306 | - public function body_class( $classes ) { |
|
307 | - $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
308 | - $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
309 | - if ( is_checkout() ) { |
|
310 | - $layout = get_theme_mod( 'lsx_wc_checkout_layout', 'default' ); |
|
311 | - |
|
312 | - if ( 'default' === $layout ) { |
|
313 | - $classes[] = 'lsx-wc-checkout-layout-default'; |
|
314 | - } elseif ( 'stacked' === $layout ) { |
|
315 | - $classes[] = 'lsx-wc-checkout-layout-stacked'; |
|
316 | - } elseif ( 'columns' === $layout ) { |
|
317 | - $classes[] = 'lsx-wc-checkout-layout-two-column-addreses'; |
|
318 | - } |
|
319 | - if ( ! empty( $distraction_free ) ) { |
|
320 | - $classes[] = 'lsx-wc-checkout-distraction-free'; |
|
321 | - } |
|
322 | - if ( ! empty( $two_step_checkout ) ) { |
|
323 | - $classes[] = 'lsx-wc-checkout-two-steps'; |
|
324 | - } |
|
325 | - } |
|
326 | - |
|
327 | - return $classes; |
|
328 | - } |
|
329 | - |
|
330 | - /** |
|
331 | - * WC thank you page. |
|
332 | - * |
|
333 | - * @since 1.1.1 |
|
334 | - */ |
|
335 | - public function thankyou_page() { |
|
336 | - global $wp; |
|
337 | - |
|
338 | - if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { |
|
339 | - $thankyou_page = get_theme_mod( 'lsx_wc_checkout_thankyou_page', '0' ); |
|
340 | - |
|
341 | - if ( ! empty( $thankyou_page ) && ! is_page( $thankyou_page ) ) { |
|
342 | - $order_id = apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order-received'] ) ); |
|
343 | - $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ); |
|
344 | - |
|
345 | - if ( $order_id > 0 ) { |
|
346 | - wp_safe_redirect( get_permalink( $thankyou_page ) . '?order-received=' . $order_id . '&key=' . $order_key, 302 ); |
|
347 | - exit; |
|
348 | - } |
|
349 | - } |
|
350 | - } |
|
351 | - } |
|
352 | - |
|
353 | - /** |
|
354 | - * Display WC checkout steps. |
|
355 | - * |
|
356 | - * @since 1.1.1 |
|
357 | - */ |
|
358 | - public function checkout_steps() { |
|
359 | - $cart_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
360 | - if ( ( is_checkout() || is_cart() ) && ! empty( get_theme_mod( 'lsx_checkout_steps', '1' ) ) ) : |
|
361 | - global $wp; |
|
362 | - ?> |
|
4 | + /** |
|
5 | + * LSX Customizer WooCommerce Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_WooCommerce extends LSX_Customizer { |
|
14 | + |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.1.1 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
22 | + |
|
23 | + add_filter( 'body_class', array( $this, 'body_class' ), 2999 ); |
|
24 | + |
|
25 | + add_action( 'template_redirect', array( $this, 'thankyou_page' ), 2999 ); |
|
26 | + |
|
27 | + if ( empty( get_theme_mod( 'lsx_two_step_checkout', false ) ) ) { |
|
28 | + add_action( 'lsx_entry_inside_top', array( $this, 'checkout_steps' ), 15 ); |
|
29 | + } |
|
30 | + |
|
31 | + add_action( 'wp', array( $this, 'cart_extra_html' ), 2999 ); |
|
32 | + add_action( 'wp', array( $this, 'checkout_extra_html' ), 2999 ); |
|
33 | + add_action( 'lsx_wc_cart_menu_item_position', array( $this, 'cart_menu_item_position' ) ); |
|
34 | + add_action( 'lsx_wc_cart_menu_item_class', array( $this, 'cart_menu_item_class' ) ); |
|
35 | + |
|
36 | + add_filter( 'wp_nav_menu_items', array( $this, 'my_account_menu_item' ), 9, 2 ); |
|
37 | + add_action( 'lsx_wc_my_account_menu_item_position', array( $this, 'my_account_menu_item_position' ) ); |
|
38 | + add_action( 'lsx_wc_my_account_menu_item_class', array( $this, 'my_account_menu_item_class' ) ); |
|
39 | + |
|
40 | + // Shop Layout Switcher. |
|
41 | + //add_action( 'wp_head', array( $this, 'show_layout_switcher' ), 1 ); |
|
42 | + //add_filter( 'gridlist_toggle_button_output', array( $this, 'gridlist_toggle_button_output' ), 10, 3 ); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Customizer Controls and Settings. |
|
47 | + * |
|
48 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
49 | + * @since 1.1.1 |
|
50 | + */ |
|
51 | + public function customize_register( $wp_customize ) { |
|
52 | + /** |
|
53 | + * Checkout. |
|
54 | + */ |
|
55 | + |
|
56 | + $wp_customize->add_section( 'lsx-wc-checkout', array( |
|
57 | + 'title' => esc_html__( 'LSX Checkout', 'lsx-customizer' ), |
|
58 | + 'description' => esc_html__( 'Change the WooCommerce checkout settings.', 'lsx-customizer' ), |
|
59 | + 'panel' => 'woocommerce', |
|
60 | + 'priority' => 3, |
|
61 | + ) ); |
|
62 | + |
|
63 | + $wp_customize->add_setting( 'lsx_checkout_steps', array( |
|
64 | + 'default' => true, |
|
65 | + 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
66 | + ) ); |
|
67 | + |
|
68 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_checkout_steps', array( |
|
69 | + 'label' => esc_html__( 'Steps', 'lsx-customizer' ), |
|
70 | + 'description' => esc_html__( 'Enable the checkout steps header.', 'lsx-customizer' ), |
|
71 | + 'section' => 'lsx-wc-checkout', |
|
72 | + 'settings' => 'lsx_checkout_steps', |
|
73 | + 'type' => 'checkbox', |
|
74 | + 'priority' => 1, |
|
75 | + ) ) ); |
|
76 | + |
|
77 | + /** |
|
78 | + * Checkout Layout |
|
79 | + */ |
|
80 | + $wp_customize->add_setting( 'lsx_wc_checkout_layout', array( |
|
81 | + 'default' => 'default', |
|
82 | + 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
83 | + ) ); |
|
84 | + |
|
85 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_checkout_layout', array( |
|
86 | + 'label' => esc_html__( 'Layout', 'lsx-customizer' ), |
|
87 | + 'description' => esc_html__( 'WooCommerce checkout layout.', 'lsx-customizer' ), |
|
88 | + 'section' => 'lsx-wc-checkout', |
|
89 | + 'settings' => 'lsx_wc_checkout_layout', |
|
90 | + 'type' => 'select', |
|
91 | + 'priority' => 2, |
|
92 | + 'choices' => array( |
|
93 | + 'default' => esc_html__( 'Default', 'lsx-customizer' ), |
|
94 | + 'stacked' => esc_html__( 'Stacked', 'lsx-customizer' ), |
|
95 | + 'columns' => esc_html__( 'Columns', 'lsx-customizer' ), |
|
96 | + ), |
|
97 | + ) ) ); |
|
98 | + |
|
99 | + $wp_customize->add_setting( 'lsx_wc_checkout_thankyou_page', array( |
|
100 | + 'default' => '0', |
|
101 | + 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
102 | + ) ); |
|
103 | + |
|
104 | + $choices = array( |
|
105 | + '0' => esc_html__( 'Default', 'lsx-customizer' ), |
|
106 | + ); |
|
107 | + |
|
108 | + /** |
|
109 | + * Distraction Free Checkout |
|
110 | + */ |
|
111 | + $wp_customize->add_setting( 'lsx_distraction_free_checkout', array( |
|
112 | + 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
113 | + ) ); |
|
114 | + |
|
115 | + $wp_customize->add_control( new WP_Customize_Control( |
|
116 | + $wp_customize, |
|
117 | + 'lsx_distraction_free_checkout', |
|
118 | + array( |
|
119 | + 'label' => esc_html__( 'Distraction Free Checkout', 'lsx-customizer' ), |
|
120 | + 'description' => esc_html__( 'Removes all clutter from the checkout, allowing the customer to focus entirely on that procedure. Removes the stepped cart and checkout.', 'lsx-customizer' ), |
|
121 | + 'section' => 'lsx-wc-checkout', |
|
122 | + 'settings' => 'lsx_distraction_free_checkout', |
|
123 | + 'type' => 'checkbox', |
|
124 | + 'priority' => 3, |
|
125 | + ) |
|
126 | + ) ); |
|
127 | + |
|
128 | + /** |
|
129 | + * Two Step Checkout |
|
130 | + */ |
|
131 | + $wp_customize->add_setting( 'lsx_two_step_checkout', array( |
|
132 | + 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
133 | + ) ); |
|
134 | + |
|
135 | + $wp_customize->add_control( new WP_Customize_Control( |
|
136 | + $wp_customize, |
|
137 | + 'lsx_two_step_checkout', |
|
138 | + array( |
|
139 | + 'label' => esc_html__( 'Two Step Checkout', 'lsx-customizer' ), |
|
140 | + 'description' => esc_html__( 'Separates the customer details collection form, and the order summary / payment details form in to two separate pages. Removes the stepped cart and checkout.', 'lsx-customizer' ), |
|
141 | + 'section' => 'lsx-wc-checkout', |
|
142 | + 'settings' => 'lsx_two_step_checkout', |
|
143 | + 'type' => 'checkbox', |
|
144 | + 'priority' => 4, |
|
145 | + ) |
|
146 | + ) ); |
|
147 | + |
|
148 | + /** |
|
149 | + * Thank you page options |
|
150 | + */ |
|
151 | + $pages = get_pages(); |
|
152 | + |
|
153 | + foreach ( $pages as $key => $page ) { |
|
154 | + $choices[ $page->ID ] = $page->post_title; |
|
155 | + } |
|
156 | + |
|
157 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_checkout_thankyou_page', array( |
|
158 | + 'label' => esc_html__( 'Thank You Page', 'lsx-customizer' ), |
|
159 | + 'description' => esc_html__( 'WooCommerce checkout thank you page.', 'lsx-customizer' ), |
|
160 | + 'section' => 'lsx-wc-checkout', |
|
161 | + 'settings' => 'lsx_wc_checkout_thankyou_page', |
|
162 | + 'type' => 'select', |
|
163 | + 'priority' => 5, |
|
164 | + 'choices' => $choices, |
|
165 | + ) ) ); |
|
166 | + |
|
167 | + $wp_customize->add_setting( 'lsx_wc_checkout_extra_html', array( |
|
168 | + 'default' => '', |
|
169 | + 'sanitize_callback' => 'wp_kses_post', |
|
170 | + ) ); |
|
171 | + |
|
172 | + $wp_customize->add_control( new LSX_Customizer_Wysiwyg_Control( $wp_customize, 'lsx_wc_checkout_extra_html', array( |
|
173 | + 'label' => esc_html__( 'Extra HTML', 'lsx-customizer' ), |
|
174 | + 'description' => esc_html__( 'Extra HTML to display at checkout page (bottom/right).', 'lsx-customizer' ), |
|
175 | + 'section' => 'lsx-wc-checkout', |
|
176 | + 'settings' => 'lsx_wc_checkout_extra_html', |
|
177 | + 'priority' => 6, |
|
178 | + 'type' => 'wysiwyg', |
|
179 | + ) ) ); |
|
180 | + |
|
181 | + /** |
|
182 | + * Cart. |
|
183 | + */ |
|
184 | + |
|
185 | + $wp_customize->add_setting( 'lsx_wc_cart_menu_item_style', array( |
|
186 | + 'default' => 'extended', |
|
187 | + 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
188 | + ) ); |
|
189 | + |
|
190 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_cart_menu_item_style', array( |
|
191 | + 'label' => esc_html__( 'Menu Item Style', 'lsx-customizer' ), |
|
192 | + 'description' => esc_html__( 'WooCommerce menu item cart style.', 'lsx-customizer' ), |
|
193 | + 'section' => 'lsx-wc-cart', |
|
194 | + 'settings' => 'lsx_wc_cart_menu_item_style', |
|
195 | + 'type' => 'select', |
|
196 | + 'priority' => 2, |
|
197 | + 'choices' => array( |
|
198 | + 'simple' => esc_html__( 'Simple', 'lsx-customizer' ), |
|
199 | + 'extended' => esc_html__( 'Extended', 'lsx-customizer' ), |
|
200 | + ), |
|
201 | + ) ) ); |
|
202 | + |
|
203 | + $wp_customize->add_setting( 'lsx_wc_cart_menu_item_position', array( |
|
204 | + 'default' => 'main-menu-in', |
|
205 | + 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
206 | + ) ); |
|
207 | + |
|
208 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_cart_menu_item_position', array( |
|
209 | + 'label' => esc_html__( 'Menu Item Position', 'lsx-customizer' ), |
|
210 | + 'description' => esc_html__( 'WooCommerce menu item cart position.', 'lsx-customizer' ), |
|
211 | + 'section' => 'lsx-wc-cart', |
|
212 | + 'settings' => 'lsx_wc_cart_menu_item_position', |
|
213 | + 'type' => 'select', |
|
214 | + 'priority' => 3, |
|
215 | + 'choices' => array( |
|
216 | + 'main-menu-in' => esc_html__( 'Main Menu (as last item)', 'lsx-customizer' ), |
|
217 | + 'main-menu-out' => esc_html__( 'Main Menu (as last item, right aligned)', 'lsx-customizer' ), |
|
218 | + 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx-customizer' ), |
|
219 | + 'top-menu-right' => esc_html__( 'Top Menu (right)', 'lsx-customizer' ), |
|
220 | + ), |
|
221 | + ) ) ); |
|
222 | + |
|
223 | + $wp_customize->add_setting( 'lsx_wc_cart_extra_html', array( |
|
224 | + 'default' => '', |
|
225 | + 'sanitize_callback' => 'wp_kses_post', |
|
226 | + ) ); |
|
227 | + |
|
228 | + $wp_customize->add_control( new LSX_Customizer_Wysiwyg_Control( $wp_customize, 'lsx_wc_cart_extra_html', array( |
|
229 | + 'label' => esc_html__( 'Extra HTML', 'lsx-customizer' ), |
|
230 | + 'description' => esc_html__( 'Extra HTML to display at cart page (bottom/left).', 'lsx-customizer' ), |
|
231 | + 'section' => 'lsx-wc-cart', |
|
232 | + 'settings' => 'lsx_wc_cart_extra_html', |
|
233 | + 'priority' => 4, |
|
234 | + 'type' => 'wysiwyg', |
|
235 | + ) ) ); |
|
236 | + |
|
237 | + /** |
|
238 | + * My Account. |
|
239 | + */ |
|
240 | + |
|
241 | + $wp_customize->add_section( 'lsx-wc-my-account', array( |
|
242 | + 'title' => esc_html__( 'LSX My Account', 'lsx-customizer' ), |
|
243 | + 'description' => esc_html__( 'Change the WooCommerce My Account settings.', 'lsx-customizer' ), |
|
244 | + 'panel' => 'woocommerce', |
|
245 | + 'priority' => 4, |
|
246 | + ) ); |
|
247 | + |
|
248 | + $wp_customize->add_setting( 'lsx_wc_my_account_menu_item', array( |
|
249 | + 'default' => false, |
|
250 | + 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
251 | + ) ); |
|
252 | + |
|
253 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item', array( |
|
254 | + 'label' => esc_html__( 'Menu Item', 'lsx-customizer' ), |
|
255 | + 'description' => esc_html__( 'Enable the My Account menu item.', 'lsx-customizer' ), |
|
256 | + 'section' => 'lsx-wc-my-account', |
|
257 | + 'settings' => 'lsx_wc_my_account_menu_item', |
|
258 | + 'type' => 'checkbox', |
|
259 | + 'priority' => 1, |
|
260 | + ) ) ); |
|
261 | + |
|
262 | + $wp_customize->add_setting( 'lsx_wc_my_account_menu_item_style', array( |
|
263 | + 'default' => 'extended', |
|
264 | + 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
265 | + ) ); |
|
266 | + |
|
267 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item_style', array( |
|
268 | + 'label' => esc_html__( 'Menu Item Style', 'lsx-customizer' ), |
|
269 | + 'description' => esc_html__( 'WooCommerce menu item My Account style.', 'lsx-customizer' ), |
|
270 | + 'section' => 'lsx-wc-my-account', |
|
271 | + 'settings' => 'lsx_wc_my_account_menu_item_style', |
|
272 | + 'type' => 'select', |
|
273 | + 'priority' => 2, |
|
274 | + 'choices' => array( |
|
275 | + 'simple' => esc_html__( 'Simple', 'lsx-customizer' ), |
|
276 | + 'extended' => esc_html__( 'Extended', 'lsx-customizer' ), |
|
277 | + ), |
|
278 | + ) ) ); |
|
279 | + |
|
280 | + $wp_customize->add_setting( 'lsx_wc_my_account_menu_item_position', array( |
|
281 | + 'default' => 'main-menu-in', |
|
282 | + 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
283 | + ) ); |
|
284 | + |
|
285 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item_position', array( |
|
286 | + 'label' => esc_html__( 'Menu Item Position', 'lsx-customizer' ), |
|
287 | + 'description' => esc_html__( 'WooCommerce menu item My Account position.', 'lsx-customizer' ), |
|
288 | + 'section' => 'lsx-wc-my-account', |
|
289 | + 'settings' => 'lsx_wc_my_account_menu_item_position', |
|
290 | + 'type' => 'select', |
|
291 | + 'priority' => 3, |
|
292 | + 'choices' => array( |
|
293 | + 'main-menu-in' => esc_html__( 'Main Menu (as last item)', 'lsx-customizer' ), |
|
294 | + 'main-menu-out' => esc_html__( 'Main Menu (as last item, right aligned)', 'lsx-customizer' ), |
|
295 | + 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx-customizer' ), |
|
296 | + 'top-menu-right' => esc_html__( 'Top Menu (right)', 'lsx-customizer' ), |
|
297 | + ), |
|
298 | + ) ) ); |
|
299 | + } |
|
300 | + |
|
301 | + /** |
|
302 | + * Add and remove WC body_class() classes. |
|
303 | + * |
|
304 | + * @since 1.1.1 |
|
305 | + */ |
|
306 | + public function body_class( $classes ) { |
|
307 | + $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
308 | + $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
309 | + if ( is_checkout() ) { |
|
310 | + $layout = get_theme_mod( 'lsx_wc_checkout_layout', 'default' ); |
|
311 | + |
|
312 | + if ( 'default' === $layout ) { |
|
313 | + $classes[] = 'lsx-wc-checkout-layout-default'; |
|
314 | + } elseif ( 'stacked' === $layout ) { |
|
315 | + $classes[] = 'lsx-wc-checkout-layout-stacked'; |
|
316 | + } elseif ( 'columns' === $layout ) { |
|
317 | + $classes[] = 'lsx-wc-checkout-layout-two-column-addreses'; |
|
318 | + } |
|
319 | + if ( ! empty( $distraction_free ) ) { |
|
320 | + $classes[] = 'lsx-wc-checkout-distraction-free'; |
|
321 | + } |
|
322 | + if ( ! empty( $two_step_checkout ) ) { |
|
323 | + $classes[] = 'lsx-wc-checkout-two-steps'; |
|
324 | + } |
|
325 | + } |
|
326 | + |
|
327 | + return $classes; |
|
328 | + } |
|
329 | + |
|
330 | + /** |
|
331 | + * WC thank you page. |
|
332 | + * |
|
333 | + * @since 1.1.1 |
|
334 | + */ |
|
335 | + public function thankyou_page() { |
|
336 | + global $wp; |
|
337 | + |
|
338 | + if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { |
|
339 | + $thankyou_page = get_theme_mod( 'lsx_wc_checkout_thankyou_page', '0' ); |
|
340 | + |
|
341 | + if ( ! empty( $thankyou_page ) && ! is_page( $thankyou_page ) ) { |
|
342 | + $order_id = apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order-received'] ) ); |
|
343 | + $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ); |
|
344 | + |
|
345 | + if ( $order_id > 0 ) { |
|
346 | + wp_safe_redirect( get_permalink( $thankyou_page ) . '?order-received=' . $order_id . '&key=' . $order_key, 302 ); |
|
347 | + exit; |
|
348 | + } |
|
349 | + } |
|
350 | + } |
|
351 | + } |
|
352 | + |
|
353 | + /** |
|
354 | + * Display WC checkout steps. |
|
355 | + * |
|
356 | + * @since 1.1.1 |
|
357 | + */ |
|
358 | + public function checkout_steps() { |
|
359 | + $cart_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
360 | + if ( ( is_checkout() || is_cart() ) && ! empty( get_theme_mod( 'lsx_checkout_steps', '1' ) ) ) : |
|
361 | + global $wp; |
|
362 | + ?> |
|
363 | 363 | <div class="lsx-wc-checkout-steps"> |
364 | 364 | <ul class="lsx-wc-checkout-steps-items"> |
365 | 365 | |
@@ -452,270 +452,270 @@ discard block |
||
452 | 452 | </ul> |
453 | 453 | </div> |
454 | 454 | <?php |
455 | - endif; |
|
456 | - } |
|
457 | - |
|
458 | - /** |
|
459 | - * Display extra HTML on checkout. |
|
460 | - * |
|
461 | - * @since 1.1.1 |
|
462 | - */ |
|
463 | - public function checkout_extra_html() { |
|
464 | - if ( is_checkout() ) { |
|
465 | - $checkout_extra_html = get_theme_mod( 'lsx_wc_checkout_extra_html', '' ); |
|
466 | - |
|
467 | - if ( ! empty( $checkout_extra_html ) ) { |
|
468 | - add_action( 'woocommerce_review_order_after_payment', array( $this, 'checkout_extra_html_echo' ), 9 ); |
|
469 | - } |
|
470 | - } |
|
471 | - } |
|
472 | - |
|
473 | - /** |
|
474 | - * Display extra HTML on checkout. |
|
475 | - * |
|
476 | - * @since 1.1.1 |
|
477 | - */ |
|
478 | - public function checkout_extra_html_echo() { |
|
479 | - if ( is_checkout() ) { |
|
480 | - $checkout_extra_html = get_theme_mod( 'lsx_wc_checkout_extra_html', '' ); |
|
481 | - |
|
482 | - if ( ! empty( $checkout_extra_html ) ) { |
|
483 | - ?> |
|
455 | + endif; |
|
456 | + } |
|
457 | + |
|
458 | + /** |
|
459 | + * Display extra HTML on checkout. |
|
460 | + * |
|
461 | + * @since 1.1.1 |
|
462 | + */ |
|
463 | + public function checkout_extra_html() { |
|
464 | + if ( is_checkout() ) { |
|
465 | + $checkout_extra_html = get_theme_mod( 'lsx_wc_checkout_extra_html', '' ); |
|
466 | + |
|
467 | + if ( ! empty( $checkout_extra_html ) ) { |
|
468 | + add_action( 'woocommerce_review_order_after_payment', array( $this, 'checkout_extra_html_echo' ), 9 ); |
|
469 | + } |
|
470 | + } |
|
471 | + } |
|
472 | + |
|
473 | + /** |
|
474 | + * Display extra HTML on checkout. |
|
475 | + * |
|
476 | + * @since 1.1.1 |
|
477 | + */ |
|
478 | + public function checkout_extra_html_echo() { |
|
479 | + if ( is_checkout() ) { |
|
480 | + $checkout_extra_html = get_theme_mod( 'lsx_wc_checkout_extra_html', '' ); |
|
481 | + |
|
482 | + if ( ! empty( $checkout_extra_html ) ) { |
|
483 | + ?> |
|
484 | 484 | <div class="lsx-wc-checkout-extra-html"> |
485 | 485 | <?php echo wp_kses_post( $checkout_extra_html ); ?> |
486 | 486 | </div> |
487 | 487 | <?php |
488 | - } |
|
489 | - } |
|
490 | - } |
|
491 | - |
|
492 | - /** |
|
493 | - * Display extra HTML on cart. |
|
494 | - * |
|
495 | - * @since 1.1.1 |
|
496 | - */ |
|
497 | - public function cart_extra_html() { |
|
498 | - if ( is_cart() ) { |
|
499 | - $cart_extra_html = get_theme_mod( 'lsx_wc_cart_extra_html', '' ); |
|
500 | - |
|
501 | - if ( ! empty( $cart_extra_html ) ) { |
|
502 | - remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); |
|
503 | - add_action( 'woocommerce_cart_collaterals', array( $this, 'cart_extra_html_echo' ), 9 ); |
|
504 | - } |
|
505 | - } |
|
506 | - } |
|
507 | - |
|
508 | - /** |
|
509 | - * Display extra HTML on cart. |
|
510 | - * |
|
511 | - * @since 1.1.1 |
|
512 | - */ |
|
513 | - public function cart_extra_html_echo() { |
|
514 | - if ( is_cart() ) { |
|
515 | - $cart_extra_html = get_theme_mod( 'lsx_wc_cart_extra_html', '' ); |
|
516 | - |
|
517 | - if ( ! empty( $cart_extra_html ) ) { |
|
518 | - ?> |
|
488 | + } |
|
489 | + } |
|
490 | + } |
|
491 | + |
|
492 | + /** |
|
493 | + * Display extra HTML on cart. |
|
494 | + * |
|
495 | + * @since 1.1.1 |
|
496 | + */ |
|
497 | + public function cart_extra_html() { |
|
498 | + if ( is_cart() ) { |
|
499 | + $cart_extra_html = get_theme_mod( 'lsx_wc_cart_extra_html', '' ); |
|
500 | + |
|
501 | + if ( ! empty( $cart_extra_html ) ) { |
|
502 | + remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); |
|
503 | + add_action( 'woocommerce_cart_collaterals', array( $this, 'cart_extra_html_echo' ), 9 ); |
|
504 | + } |
|
505 | + } |
|
506 | + } |
|
507 | + |
|
508 | + /** |
|
509 | + * Display extra HTML on cart. |
|
510 | + * |
|
511 | + * @since 1.1.1 |
|
512 | + */ |
|
513 | + public function cart_extra_html_echo() { |
|
514 | + if ( is_cart() ) { |
|
515 | + $cart_extra_html = get_theme_mod( 'lsx_wc_cart_extra_html', '' ); |
|
516 | + |
|
517 | + if ( ! empty( $cart_extra_html ) ) { |
|
518 | + ?> |
|
519 | 519 | <div class="lsx-wc-cart-extra-html"> |
520 | 520 | <?php echo wp_kses_post( $cart_extra_html ); ?> |
521 | 521 | </div> |
522 | 522 | <?php |
523 | - } |
|
524 | - } |
|
525 | - } |
|
526 | - |
|
527 | - /** |
|
528 | - * The place (menu) to display the cart menu item position. |
|
529 | - * |
|
530 | - * @since 1.1.1 |
|
531 | - */ |
|
532 | - public function cart_menu_item_position( $menu_position ) { |
|
533 | - $position = get_theme_mod( 'lsx_wc_cart_menu_item_position', '' ); |
|
534 | - |
|
535 | - if ( ! empty( $position ) ) { |
|
536 | - switch ( $position ) { |
|
537 | - case 'main-menu-in': |
|
538 | - case 'main-menu-out': |
|
539 | - $menu_position = 'primary'; |
|
540 | - break; |
|
541 | - |
|
542 | - case 'top-menu-right': |
|
543 | - $menu_position = 'top-menu'; |
|
544 | - break; |
|
545 | - |
|
546 | - case 'top-menu-left': |
|
547 | - $menu_position = 'top-menu-left'; |
|
548 | - break; |
|
549 | - } |
|
550 | - } |
|
551 | - |
|
552 | - return $menu_position; |
|
553 | - } |
|
554 | - |
|
555 | - /** |
|
556 | - * The place (menu) to display the cart menu item position. |
|
557 | - * |
|
558 | - * @since 1.1.1 |
|
559 | - */ |
|
560 | - public function cart_menu_item_class( $item_class ) { |
|
561 | - $position = get_theme_mod( 'lsx_wc_cart_menu_item_position', '' ); |
|
562 | - |
|
563 | - if ( 'main-menu-out' === $position ) { |
|
564 | - $item_class .= ' lsx-wc-cart-menu-item-right-aligned'; |
|
565 | - } |
|
566 | - |
|
567 | - $style = get_theme_mod( 'lsx_wc_cart_menu_item_style', '' ); |
|
568 | - |
|
569 | - if ( 'simple' === $style ) { |
|
570 | - $item_class .= ' lsx-wc-cart-menu-item-simple'; |
|
571 | - } |
|
572 | - |
|
573 | - return $item_class; |
|
574 | - } |
|
575 | - |
|
576 | - /** |
|
577 | - * Adds WC My Account to the header. |
|
578 | - * |
|
579 | - * @since 1.1.1 |
|
580 | - */ |
|
581 | - public function my_account_menu_item( $items, $args ) { |
|
582 | - $my_account_menu_item_position = apply_filters( 'lsx_wc_my_account_menu_item_position', 'primary' ); |
|
583 | - |
|
584 | - if ( $my_account_menu_item_position === $args->theme_location || ( 'primary_logged_out' === $args->theme_location && 'primary' === $my_account_menu_item_position ) ) { |
|
585 | - $customizer_option = get_theme_mod( 'lsx_wc_my_account_menu_item', false ); |
|
586 | - |
|
587 | - if ( ! empty( $customizer_option ) ) { |
|
588 | - if ( is_account_page() ) { |
|
589 | - $class = 'current-menu-item'; |
|
590 | - } else { |
|
591 | - $class = ''; |
|
592 | - } |
|
593 | - |
|
594 | - $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-my-account-menu-item ' . $class; |
|
595 | - $item_class = apply_filters( 'lsx_wc_my_account_menu_item_class', $item_class ); |
|
596 | - |
|
597 | - $endpoints = WC()->query->get_query_vars(); |
|
598 | - |
|
599 | - if ( is_user_logged_in() ) { |
|
600 | - $item = '<li class="' . $item_class . '">'; |
|
601 | - $item .= '<a title="' . esc_attr__( 'View your account', 'lsx-customizer' ) . '" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"><span>' . esc_attr__( 'My Account', 'lsx-customizer' ) . '</span></a>'; |
|
602 | - $item .= '<ul role="menu" class=" dropdown-menu lsx-wc-my-account-sub-menu">'; |
|
603 | - foreach ( wc_get_account_menu_items() as $endpoint => $label ) { |
|
604 | - $slug = $endpoint; |
|
605 | - if ( isset( $endpoints[ $endpoint ] ) && '' !== $endpoints[ $endpoint ] ) { |
|
606 | - $slug = $endpoints[ $endpoint ]; |
|
607 | - } |
|
608 | - if ( 'dashboard' === $slug ) { |
|
609 | - $slug = ''; |
|
610 | - } |
|
611 | - $item .= '<li class="menu-item"><a title="" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) . $slug ) . '">' . $label . '</a></li>'; |
|
612 | - } |
|
613 | - $item .= '</ul></li>'; |
|
614 | - |
|
615 | - } else { |
|
616 | - $item = '<li class="' . $item_class . '">' . |
|
617 | - '<a title="' . esc_attr__( 'View your account', 'lsx-customizer' ) . '" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) . '"><span>' . esc_attr__( 'Login', 'lsx-customizer' ) . '</span></a>' . |
|
618 | - '</li>'; |
|
619 | - } |
|
620 | - |
|
621 | - $item = apply_filters( 'lsx_wc_my_account_menu_item', $item ); |
|
622 | - |
|
623 | - if ( 'top-menu' === $args->theme_location ) { |
|
624 | - $items = $item . $items; |
|
625 | - } else { |
|
626 | - $items = $items . $item; |
|
627 | - } |
|
628 | - } |
|
629 | - } |
|
630 | - |
|
631 | - return $items; |
|
632 | - } |
|
633 | - |
|
634 | - /** |
|
635 | - * The place (menu) to display the My Account menu item position. |
|
636 | - * |
|
637 | - * @since 1.1.1 |
|
638 | - */ |
|
639 | - public function my_account_menu_item_position( $menu_position ) { |
|
640 | - $position = get_theme_mod( 'lsx_wc_my_account_menu_item_position', '' ); |
|
641 | - |
|
642 | - if ( ! empty( $position ) ) { |
|
643 | - switch ( $position ) { |
|
644 | - case 'main-menu-in': |
|
645 | - case 'main-menu-out': |
|
646 | - $menu_position = 'primary'; |
|
647 | - break; |
|
648 | - |
|
649 | - case 'top-menu-right': |
|
650 | - $menu_position = 'top-menu'; |
|
651 | - break; |
|
652 | - |
|
653 | - case 'top-menu-left': |
|
654 | - $menu_position = 'top-menu-left'; |
|
655 | - break; |
|
656 | - } |
|
657 | - } |
|
658 | - |
|
659 | - return $menu_position; |
|
660 | - } |
|
661 | - |
|
662 | - /** |
|
663 | - * The place (menu) to display the My Account menu item position. |
|
664 | - * |
|
665 | - * @since 1.1.1 |
|
666 | - */ |
|
667 | - public function my_account_menu_item_class( $item_class ) { |
|
668 | - $position = get_theme_mod( 'lsx_wc_my_account_menu_item_position', '' ); |
|
669 | - |
|
670 | - if ( 'main-menu-out' === $position ) { |
|
671 | - $item_class .= ' lsx-wc-my-account-menu-item-right-aligned'; |
|
672 | - } |
|
673 | - |
|
674 | - if ( ! is_user_logged_in() ) { |
|
675 | - $item_class .= ' lsx-wc-my-account-login'; |
|
676 | - } |
|
677 | - |
|
678 | - $style = get_theme_mod( 'lsx_wc_my_account_menu_item_style', '' ); |
|
679 | - |
|
680 | - if ( 'simple' === $style ) { |
|
681 | - $item_class .= ' lsx-wc-my-account-menu-item-simple'; |
|
682 | - } |
|
683 | - |
|
684 | - return $item_class; |
|
685 | - } |
|
686 | - /** |
|
687 | - * Display the woocommerce archive swticher. |
|
688 | - */ |
|
689 | - public function show_layout_switcher() { |
|
690 | - $body_classes = get_body_class(); |
|
691 | - if ( in_array( 'post-type-archive-product', $body_classes ) ) { |
|
692 | - global $WC_List_Grid; |
|
693 | - if ( null !== $WC_List_Grid ) { |
|
694 | - remove_action( 'woocommerce_before_shop_loop', array( $WC_List_Grid, 'gridlist_toggle_button' ), 30 ); |
|
695 | - add_action( 'lsx_banner_inner_bottom', array( $this, 'shop_gridlist_toggle_button' ), 90 ); |
|
696 | - add_action( 'lsx_global_header_inner_bottom', array( $this, 'shop_gridlist_toggle_button' ), 90 ); |
|
697 | - wp_deregister_style( 'grid-list-button' ); |
|
698 | - } |
|
699 | - } |
|
700 | - } |
|
701 | - /** |
|
702 | - * Display the woocommerce archive swticher. |
|
703 | - */ |
|
704 | - public function shop_gridlist_toggle_button() { |
|
705 | - global $WC_List_Grid; |
|
706 | - ?> |
|
523 | + } |
|
524 | + } |
|
525 | + } |
|
526 | + |
|
527 | + /** |
|
528 | + * The place (menu) to display the cart menu item position. |
|
529 | + * |
|
530 | + * @since 1.1.1 |
|
531 | + */ |
|
532 | + public function cart_menu_item_position( $menu_position ) { |
|
533 | + $position = get_theme_mod( 'lsx_wc_cart_menu_item_position', '' ); |
|
534 | + |
|
535 | + if ( ! empty( $position ) ) { |
|
536 | + switch ( $position ) { |
|
537 | + case 'main-menu-in': |
|
538 | + case 'main-menu-out': |
|
539 | + $menu_position = 'primary'; |
|
540 | + break; |
|
541 | + |
|
542 | + case 'top-menu-right': |
|
543 | + $menu_position = 'top-menu'; |
|
544 | + break; |
|
545 | + |
|
546 | + case 'top-menu-left': |
|
547 | + $menu_position = 'top-menu-left'; |
|
548 | + break; |
|
549 | + } |
|
550 | + } |
|
551 | + |
|
552 | + return $menu_position; |
|
553 | + } |
|
554 | + |
|
555 | + /** |
|
556 | + * The place (menu) to display the cart menu item position. |
|
557 | + * |
|
558 | + * @since 1.1.1 |
|
559 | + */ |
|
560 | + public function cart_menu_item_class( $item_class ) { |
|
561 | + $position = get_theme_mod( 'lsx_wc_cart_menu_item_position', '' ); |
|
562 | + |
|
563 | + if ( 'main-menu-out' === $position ) { |
|
564 | + $item_class .= ' lsx-wc-cart-menu-item-right-aligned'; |
|
565 | + } |
|
566 | + |
|
567 | + $style = get_theme_mod( 'lsx_wc_cart_menu_item_style', '' ); |
|
568 | + |
|
569 | + if ( 'simple' === $style ) { |
|
570 | + $item_class .= ' lsx-wc-cart-menu-item-simple'; |
|
571 | + } |
|
572 | + |
|
573 | + return $item_class; |
|
574 | + } |
|
575 | + |
|
576 | + /** |
|
577 | + * Adds WC My Account to the header. |
|
578 | + * |
|
579 | + * @since 1.1.1 |
|
580 | + */ |
|
581 | + public function my_account_menu_item( $items, $args ) { |
|
582 | + $my_account_menu_item_position = apply_filters( 'lsx_wc_my_account_menu_item_position', 'primary' ); |
|
583 | + |
|
584 | + if ( $my_account_menu_item_position === $args->theme_location || ( 'primary_logged_out' === $args->theme_location && 'primary' === $my_account_menu_item_position ) ) { |
|
585 | + $customizer_option = get_theme_mod( 'lsx_wc_my_account_menu_item', false ); |
|
586 | + |
|
587 | + if ( ! empty( $customizer_option ) ) { |
|
588 | + if ( is_account_page() ) { |
|
589 | + $class = 'current-menu-item'; |
|
590 | + } else { |
|
591 | + $class = ''; |
|
592 | + } |
|
593 | + |
|
594 | + $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-my-account-menu-item ' . $class; |
|
595 | + $item_class = apply_filters( 'lsx_wc_my_account_menu_item_class', $item_class ); |
|
596 | + |
|
597 | + $endpoints = WC()->query->get_query_vars(); |
|
598 | + |
|
599 | + if ( is_user_logged_in() ) { |
|
600 | + $item = '<li class="' . $item_class . '">'; |
|
601 | + $item .= '<a title="' . esc_attr__( 'View your account', 'lsx-customizer' ) . '" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"><span>' . esc_attr__( 'My Account', 'lsx-customizer' ) . '</span></a>'; |
|
602 | + $item .= '<ul role="menu" class=" dropdown-menu lsx-wc-my-account-sub-menu">'; |
|
603 | + foreach ( wc_get_account_menu_items() as $endpoint => $label ) { |
|
604 | + $slug = $endpoint; |
|
605 | + if ( isset( $endpoints[ $endpoint ] ) && '' !== $endpoints[ $endpoint ] ) { |
|
606 | + $slug = $endpoints[ $endpoint ]; |
|
607 | + } |
|
608 | + if ( 'dashboard' === $slug ) { |
|
609 | + $slug = ''; |
|
610 | + } |
|
611 | + $item .= '<li class="menu-item"><a title="" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) . $slug ) . '">' . $label . '</a></li>'; |
|
612 | + } |
|
613 | + $item .= '</ul></li>'; |
|
614 | + |
|
615 | + } else { |
|
616 | + $item = '<li class="' . $item_class . '">' . |
|
617 | + '<a title="' . esc_attr__( 'View your account', 'lsx-customizer' ) . '" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) . '"><span>' . esc_attr__( 'Login', 'lsx-customizer' ) . '</span></a>' . |
|
618 | + '</li>'; |
|
619 | + } |
|
620 | + |
|
621 | + $item = apply_filters( 'lsx_wc_my_account_menu_item', $item ); |
|
622 | + |
|
623 | + if ( 'top-menu' === $args->theme_location ) { |
|
624 | + $items = $item . $items; |
|
625 | + } else { |
|
626 | + $items = $items . $item; |
|
627 | + } |
|
628 | + } |
|
629 | + } |
|
630 | + |
|
631 | + return $items; |
|
632 | + } |
|
633 | + |
|
634 | + /** |
|
635 | + * The place (menu) to display the My Account menu item position. |
|
636 | + * |
|
637 | + * @since 1.1.1 |
|
638 | + */ |
|
639 | + public function my_account_menu_item_position( $menu_position ) { |
|
640 | + $position = get_theme_mod( 'lsx_wc_my_account_menu_item_position', '' ); |
|
641 | + |
|
642 | + if ( ! empty( $position ) ) { |
|
643 | + switch ( $position ) { |
|
644 | + case 'main-menu-in': |
|
645 | + case 'main-menu-out': |
|
646 | + $menu_position = 'primary'; |
|
647 | + break; |
|
648 | + |
|
649 | + case 'top-menu-right': |
|
650 | + $menu_position = 'top-menu'; |
|
651 | + break; |
|
652 | + |
|
653 | + case 'top-menu-left': |
|
654 | + $menu_position = 'top-menu-left'; |
|
655 | + break; |
|
656 | + } |
|
657 | + } |
|
658 | + |
|
659 | + return $menu_position; |
|
660 | + } |
|
661 | + |
|
662 | + /** |
|
663 | + * The place (menu) to display the My Account menu item position. |
|
664 | + * |
|
665 | + * @since 1.1.1 |
|
666 | + */ |
|
667 | + public function my_account_menu_item_class( $item_class ) { |
|
668 | + $position = get_theme_mod( 'lsx_wc_my_account_menu_item_position', '' ); |
|
669 | + |
|
670 | + if ( 'main-menu-out' === $position ) { |
|
671 | + $item_class .= ' lsx-wc-my-account-menu-item-right-aligned'; |
|
672 | + } |
|
673 | + |
|
674 | + if ( ! is_user_logged_in() ) { |
|
675 | + $item_class .= ' lsx-wc-my-account-login'; |
|
676 | + } |
|
677 | + |
|
678 | + $style = get_theme_mod( 'lsx_wc_my_account_menu_item_style', '' ); |
|
679 | + |
|
680 | + if ( 'simple' === $style ) { |
|
681 | + $item_class .= ' lsx-wc-my-account-menu-item-simple'; |
|
682 | + } |
|
683 | + |
|
684 | + return $item_class; |
|
685 | + } |
|
686 | + /** |
|
687 | + * Display the woocommerce archive swticher. |
|
688 | + */ |
|
689 | + public function show_layout_switcher() { |
|
690 | + $body_classes = get_body_class(); |
|
691 | + if ( in_array( 'post-type-archive-product', $body_classes ) ) { |
|
692 | + global $WC_List_Grid; |
|
693 | + if ( null !== $WC_List_Grid ) { |
|
694 | + remove_action( 'woocommerce_before_shop_loop', array( $WC_List_Grid, 'gridlist_toggle_button' ), 30 ); |
|
695 | + add_action( 'lsx_banner_inner_bottom', array( $this, 'shop_gridlist_toggle_button' ), 90 ); |
|
696 | + add_action( 'lsx_global_header_inner_bottom', array( $this, 'shop_gridlist_toggle_button' ), 90 ); |
|
697 | + wp_deregister_style( 'grid-list-button' ); |
|
698 | + } |
|
699 | + } |
|
700 | + } |
|
701 | + /** |
|
702 | + * Display the woocommerce archive swticher. |
|
703 | + */ |
|
704 | + public function shop_gridlist_toggle_button() { |
|
705 | + global $WC_List_Grid; |
|
706 | + ?> |
|
707 | 707 | <div class="lsx-layout-switcher"> |
708 | 708 | <span class="lsx-layout-switcher-label"><?php esc_html_e( 'Select view:', 'lsx-blog-customizer' ); ?></span> |
709 | 709 | <?php $WC_List_Grid->gridlist_toggle_button(); ?> |
710 | 710 | </div> |
711 | 711 | <?php |
712 | - } |
|
713 | - public function gridlist_toggle_button_output( $output, $grid_view, $list_view ) { |
|
714 | - $output = sprintf( '<div class="gridlist-toggle lsx-layout-switcher-options"><a href="#" class="lsx-layout-switcher-option" id="grid" title="%1$s"><span class="fa fa fa-th"></span></a><a href="#" class="lsx-layout-switcher-option" id="list" title="%2$s"><span class="fa fa-bars"></span></a></div>', $grid_view, $list_view ); |
|
715 | - return $output; |
|
716 | - } |
|
717 | - } |
|
718 | - |
|
719 | - new LSX_Customizer_WooCommerce(); |
|
712 | + } |
|
713 | + public function gridlist_toggle_button_output( $output, $grid_view, $list_view ) { |
|
714 | + $output = sprintf( '<div class="gridlist-toggle lsx-layout-switcher-options"><a href="#" class="lsx-layout-switcher-option" id="grid" title="%1$s"><span class="fa fa fa-th"></span></a><a href="#" class="lsx-layout-switcher-option" id="list" title="%2$s"><span class="fa fa-bars"></span></a></div>', $grid_view, $list_view ); |
|
715 | + return $output; |
|
716 | + } |
|
717 | + } |
|
718 | + |
|
719 | + new LSX_Customizer_WooCommerce(); |
|
720 | 720 | |
721 | 721 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! class_exists( 'LSX_Customizer_WooCommerce' ) ) { |
|
2 | +if ( ! class_exists('LSX_Customizer_WooCommerce')) { |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * LSX Customizer WooCommerce Class |
@@ -18,24 +18,24 @@ discard block |
||
18 | 18 | * @since 1.1.1 |
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | - add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
21 | + add_action('customize_register', array($this, 'customize_register'), 20); |
|
22 | 22 | |
23 | - add_filter( 'body_class', array( $this, 'body_class' ), 2999 ); |
|
23 | + add_filter('body_class', array($this, 'body_class'), 2999); |
|
24 | 24 | |
25 | - add_action( 'template_redirect', array( $this, 'thankyou_page' ), 2999 ); |
|
25 | + add_action('template_redirect', array($this, 'thankyou_page'), 2999); |
|
26 | 26 | |
27 | - if ( empty( get_theme_mod( 'lsx_two_step_checkout', false ) ) ) { |
|
28 | - add_action( 'lsx_entry_inside_top', array( $this, 'checkout_steps' ), 15 ); |
|
27 | + if (empty(get_theme_mod('lsx_two_step_checkout', false))) { |
|
28 | + add_action('lsx_entry_inside_top', array($this, 'checkout_steps'), 15); |
|
29 | 29 | } |
30 | 30 | |
31 | - add_action( 'wp', array( $this, 'cart_extra_html' ), 2999 ); |
|
32 | - add_action( 'wp', array( $this, 'checkout_extra_html' ), 2999 ); |
|
33 | - add_action( 'lsx_wc_cart_menu_item_position', array( $this, 'cart_menu_item_position' ) ); |
|
34 | - add_action( 'lsx_wc_cart_menu_item_class', array( $this, 'cart_menu_item_class' ) ); |
|
31 | + add_action('wp', array($this, 'cart_extra_html'), 2999); |
|
32 | + add_action('wp', array($this, 'checkout_extra_html'), 2999); |
|
33 | + add_action('lsx_wc_cart_menu_item_position', array($this, 'cart_menu_item_position')); |
|
34 | + add_action('lsx_wc_cart_menu_item_class', array($this, 'cart_menu_item_class')); |
|
35 | 35 | |
36 | - add_filter( 'wp_nav_menu_items', array( $this, 'my_account_menu_item' ), 9, 2 ); |
|
37 | - add_action( 'lsx_wc_my_account_menu_item_position', array( $this, 'my_account_menu_item_position' ) ); |
|
38 | - add_action( 'lsx_wc_my_account_menu_item_class', array( $this, 'my_account_menu_item_class' ) ); |
|
36 | + add_filter('wp_nav_menu_items', array($this, 'my_account_menu_item'), 9, 2); |
|
37 | + add_action('lsx_wc_my_account_menu_item_position', array($this, 'my_account_menu_item_position')); |
|
38 | + add_action('lsx_wc_my_account_menu_item_class', array($this, 'my_account_menu_item_class')); |
|
39 | 39 | |
40 | 40 | // Shop Layout Switcher. |
41 | 41 | //add_action( 'wp_head', array( $this, 'show_layout_switcher' ), 1 ); |
@@ -48,254 +48,254 @@ discard block |
||
48 | 48 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
49 | 49 | * @since 1.1.1 |
50 | 50 | */ |
51 | - public function customize_register( $wp_customize ) { |
|
51 | + public function customize_register($wp_customize) { |
|
52 | 52 | /** |
53 | 53 | * Checkout. |
54 | 54 | */ |
55 | 55 | |
56 | - $wp_customize->add_section( 'lsx-wc-checkout', array( |
|
57 | - 'title' => esc_html__( 'LSX Checkout', 'lsx-customizer' ), |
|
58 | - 'description' => esc_html__( 'Change the WooCommerce checkout settings.', 'lsx-customizer' ), |
|
56 | + $wp_customize->add_section('lsx-wc-checkout', array( |
|
57 | + 'title' => esc_html__('LSX Checkout', 'lsx-customizer'), |
|
58 | + 'description' => esc_html__('Change the WooCommerce checkout settings.', 'lsx-customizer'), |
|
59 | 59 | 'panel' => 'woocommerce', |
60 | 60 | 'priority' => 3, |
61 | - ) ); |
|
61 | + )); |
|
62 | 62 | |
63 | - $wp_customize->add_setting( 'lsx_checkout_steps', array( |
|
63 | + $wp_customize->add_setting('lsx_checkout_steps', array( |
|
64 | 64 | 'default' => true, |
65 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
66 | - ) ); |
|
65 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
66 | + )); |
|
67 | 67 | |
68 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_checkout_steps', array( |
|
69 | - 'label' => esc_html__( 'Steps', 'lsx-customizer' ), |
|
70 | - 'description' => esc_html__( 'Enable the checkout steps header.', 'lsx-customizer' ), |
|
68 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_checkout_steps', array( |
|
69 | + 'label' => esc_html__('Steps', 'lsx-customizer'), |
|
70 | + 'description' => esc_html__('Enable the checkout steps header.', 'lsx-customizer'), |
|
71 | 71 | 'section' => 'lsx-wc-checkout', |
72 | 72 | 'settings' => 'lsx_checkout_steps', |
73 | 73 | 'type' => 'checkbox', |
74 | 74 | 'priority' => 1, |
75 | - ) ) ); |
|
75 | + ))); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Checkout Layout |
79 | 79 | */ |
80 | - $wp_customize->add_setting( 'lsx_wc_checkout_layout', array( |
|
80 | + $wp_customize->add_setting('lsx_wc_checkout_layout', array( |
|
81 | 81 | 'default' => 'default', |
82 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
83 | - ) ); |
|
82 | + 'sanitize_callback' => array($this, 'sanitize_select'), |
|
83 | + )); |
|
84 | 84 | |
85 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_checkout_layout', array( |
|
86 | - 'label' => esc_html__( 'Layout', 'lsx-customizer' ), |
|
87 | - 'description' => esc_html__( 'WooCommerce checkout layout.', 'lsx-customizer' ), |
|
85 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_wc_checkout_layout', array( |
|
86 | + 'label' => esc_html__('Layout', 'lsx-customizer'), |
|
87 | + 'description' => esc_html__('WooCommerce checkout layout.', 'lsx-customizer'), |
|
88 | 88 | 'section' => 'lsx-wc-checkout', |
89 | 89 | 'settings' => 'lsx_wc_checkout_layout', |
90 | 90 | 'type' => 'select', |
91 | 91 | 'priority' => 2, |
92 | 92 | 'choices' => array( |
93 | - 'default' => esc_html__( 'Default', 'lsx-customizer' ), |
|
94 | - 'stacked' => esc_html__( 'Stacked', 'lsx-customizer' ), |
|
95 | - 'columns' => esc_html__( 'Columns', 'lsx-customizer' ), |
|
93 | + 'default' => esc_html__('Default', 'lsx-customizer'), |
|
94 | + 'stacked' => esc_html__('Stacked', 'lsx-customizer'), |
|
95 | + 'columns' => esc_html__('Columns', 'lsx-customizer'), |
|
96 | 96 | ), |
97 | - ) ) ); |
|
97 | + ))); |
|
98 | 98 | |
99 | - $wp_customize->add_setting( 'lsx_wc_checkout_thankyou_page', array( |
|
99 | + $wp_customize->add_setting('lsx_wc_checkout_thankyou_page', array( |
|
100 | 100 | 'default' => '0', |
101 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
102 | - ) ); |
|
101 | + 'sanitize_callback' => array($this, 'sanitize_select'), |
|
102 | + )); |
|
103 | 103 | |
104 | 104 | $choices = array( |
105 | - '0' => esc_html__( 'Default', 'lsx-customizer' ), |
|
105 | + '0' => esc_html__('Default', 'lsx-customizer'), |
|
106 | 106 | ); |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Distraction Free Checkout |
110 | 110 | */ |
111 | - $wp_customize->add_setting( 'lsx_distraction_free_checkout', array( |
|
112 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
113 | - ) ); |
|
111 | + $wp_customize->add_setting('lsx_distraction_free_checkout', array( |
|
112 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
113 | + )); |
|
114 | 114 | |
115 | - $wp_customize->add_control( new WP_Customize_Control( |
|
115 | + $wp_customize->add_control(new WP_Customize_Control( |
|
116 | 116 | $wp_customize, |
117 | 117 | 'lsx_distraction_free_checkout', |
118 | 118 | array( |
119 | - 'label' => esc_html__( 'Distraction Free Checkout', 'lsx-customizer' ), |
|
120 | - 'description' => esc_html__( 'Removes all clutter from the checkout, allowing the customer to focus entirely on that procedure. Removes the stepped cart and checkout.', 'lsx-customizer' ), |
|
119 | + 'label' => esc_html__('Distraction Free Checkout', 'lsx-customizer'), |
|
120 | + 'description' => esc_html__('Removes all clutter from the checkout, allowing the customer to focus entirely on that procedure. Removes the stepped cart and checkout.', 'lsx-customizer'), |
|
121 | 121 | 'section' => 'lsx-wc-checkout', |
122 | 122 | 'settings' => 'lsx_distraction_free_checkout', |
123 | 123 | 'type' => 'checkbox', |
124 | 124 | 'priority' => 3, |
125 | 125 | ) |
126 | - ) ); |
|
126 | + )); |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Two Step Checkout |
130 | 130 | */ |
131 | - $wp_customize->add_setting( 'lsx_two_step_checkout', array( |
|
132 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
133 | - ) ); |
|
131 | + $wp_customize->add_setting('lsx_two_step_checkout', array( |
|
132 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
133 | + )); |
|
134 | 134 | |
135 | - $wp_customize->add_control( new WP_Customize_Control( |
|
135 | + $wp_customize->add_control(new WP_Customize_Control( |
|
136 | 136 | $wp_customize, |
137 | 137 | 'lsx_two_step_checkout', |
138 | 138 | array( |
139 | - 'label' => esc_html__( 'Two Step Checkout', 'lsx-customizer' ), |
|
140 | - 'description' => esc_html__( 'Separates the customer details collection form, and the order summary / payment details form in to two separate pages. Removes the stepped cart and checkout.', 'lsx-customizer' ), |
|
139 | + 'label' => esc_html__('Two Step Checkout', 'lsx-customizer'), |
|
140 | + 'description' => esc_html__('Separates the customer details collection form, and the order summary / payment details form in to two separate pages. Removes the stepped cart and checkout.', 'lsx-customizer'), |
|
141 | 141 | 'section' => 'lsx-wc-checkout', |
142 | 142 | 'settings' => 'lsx_two_step_checkout', |
143 | 143 | 'type' => 'checkbox', |
144 | 144 | 'priority' => 4, |
145 | 145 | ) |
146 | - ) ); |
|
146 | + )); |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Thank you page options |
150 | 150 | */ |
151 | 151 | $pages = get_pages(); |
152 | 152 | |
153 | - foreach ( $pages as $key => $page ) { |
|
154 | - $choices[ $page->ID ] = $page->post_title; |
|
153 | + foreach ($pages as $key => $page) { |
|
154 | + $choices[$page->ID] = $page->post_title; |
|
155 | 155 | } |
156 | 156 | |
157 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_checkout_thankyou_page', array( |
|
158 | - 'label' => esc_html__( 'Thank You Page', 'lsx-customizer' ), |
|
159 | - 'description' => esc_html__( 'WooCommerce checkout thank you page.', 'lsx-customizer' ), |
|
157 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_wc_checkout_thankyou_page', array( |
|
158 | + 'label' => esc_html__('Thank You Page', 'lsx-customizer'), |
|
159 | + 'description' => esc_html__('WooCommerce checkout thank you page.', 'lsx-customizer'), |
|
160 | 160 | 'section' => 'lsx-wc-checkout', |
161 | 161 | 'settings' => 'lsx_wc_checkout_thankyou_page', |
162 | 162 | 'type' => 'select', |
163 | 163 | 'priority' => 5, |
164 | 164 | 'choices' => $choices, |
165 | - ) ) ); |
|
165 | + ))); |
|
166 | 166 | |
167 | - $wp_customize->add_setting( 'lsx_wc_checkout_extra_html', array( |
|
167 | + $wp_customize->add_setting('lsx_wc_checkout_extra_html', array( |
|
168 | 168 | 'default' => '', |
169 | 169 | 'sanitize_callback' => 'wp_kses_post', |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | |
172 | - $wp_customize->add_control( new LSX_Customizer_Wysiwyg_Control( $wp_customize, 'lsx_wc_checkout_extra_html', array( |
|
173 | - 'label' => esc_html__( 'Extra HTML', 'lsx-customizer' ), |
|
174 | - 'description' => esc_html__( 'Extra HTML to display at checkout page (bottom/right).', 'lsx-customizer' ), |
|
172 | + $wp_customize->add_control(new LSX_Customizer_Wysiwyg_Control($wp_customize, 'lsx_wc_checkout_extra_html', array( |
|
173 | + 'label' => esc_html__('Extra HTML', 'lsx-customizer'), |
|
174 | + 'description' => esc_html__('Extra HTML to display at checkout page (bottom/right).', 'lsx-customizer'), |
|
175 | 175 | 'section' => 'lsx-wc-checkout', |
176 | 176 | 'settings' => 'lsx_wc_checkout_extra_html', |
177 | 177 | 'priority' => 6, |
178 | 178 | 'type' => 'wysiwyg', |
179 | - ) ) ); |
|
179 | + ))); |
|
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Cart. |
183 | 183 | */ |
184 | 184 | |
185 | - $wp_customize->add_setting( 'lsx_wc_cart_menu_item_style', array( |
|
185 | + $wp_customize->add_setting('lsx_wc_cart_menu_item_style', array( |
|
186 | 186 | 'default' => 'extended', |
187 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
188 | - ) ); |
|
187 | + 'sanitize_callback' => array($this, 'sanitize_select'), |
|
188 | + )); |
|
189 | 189 | |
190 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_cart_menu_item_style', array( |
|
191 | - 'label' => esc_html__( 'Menu Item Style', 'lsx-customizer' ), |
|
192 | - 'description' => esc_html__( 'WooCommerce menu item cart style.', 'lsx-customizer' ), |
|
190 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_wc_cart_menu_item_style', array( |
|
191 | + 'label' => esc_html__('Menu Item Style', 'lsx-customizer'), |
|
192 | + 'description' => esc_html__('WooCommerce menu item cart style.', 'lsx-customizer'), |
|
193 | 193 | 'section' => 'lsx-wc-cart', |
194 | 194 | 'settings' => 'lsx_wc_cart_menu_item_style', |
195 | 195 | 'type' => 'select', |
196 | 196 | 'priority' => 2, |
197 | 197 | 'choices' => array( |
198 | - 'simple' => esc_html__( 'Simple', 'lsx-customizer' ), |
|
199 | - 'extended' => esc_html__( 'Extended', 'lsx-customizer' ), |
|
198 | + 'simple' => esc_html__('Simple', 'lsx-customizer'), |
|
199 | + 'extended' => esc_html__('Extended', 'lsx-customizer'), |
|
200 | 200 | ), |
201 | - ) ) ); |
|
201 | + ))); |
|
202 | 202 | |
203 | - $wp_customize->add_setting( 'lsx_wc_cart_menu_item_position', array( |
|
203 | + $wp_customize->add_setting('lsx_wc_cart_menu_item_position', array( |
|
204 | 204 | 'default' => 'main-menu-in', |
205 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
206 | - ) ); |
|
205 | + 'sanitize_callback' => array($this, 'sanitize_select'), |
|
206 | + )); |
|
207 | 207 | |
208 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_cart_menu_item_position', array( |
|
209 | - 'label' => esc_html__( 'Menu Item Position', 'lsx-customizer' ), |
|
210 | - 'description' => esc_html__( 'WooCommerce menu item cart position.', 'lsx-customizer' ), |
|
208 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_wc_cart_menu_item_position', array( |
|
209 | + 'label' => esc_html__('Menu Item Position', 'lsx-customizer'), |
|
210 | + 'description' => esc_html__('WooCommerce menu item cart position.', 'lsx-customizer'), |
|
211 | 211 | 'section' => 'lsx-wc-cart', |
212 | 212 | 'settings' => 'lsx_wc_cart_menu_item_position', |
213 | 213 | 'type' => 'select', |
214 | 214 | 'priority' => 3, |
215 | 215 | 'choices' => array( |
216 | - 'main-menu-in' => esc_html__( 'Main Menu (as last item)', 'lsx-customizer' ), |
|
217 | - 'main-menu-out' => esc_html__( 'Main Menu (as last item, right aligned)', 'lsx-customizer' ), |
|
218 | - 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx-customizer' ), |
|
219 | - 'top-menu-right' => esc_html__( 'Top Menu (right)', 'lsx-customizer' ), |
|
216 | + 'main-menu-in' => esc_html__('Main Menu (as last item)', 'lsx-customizer'), |
|
217 | + 'main-menu-out' => esc_html__('Main Menu (as last item, right aligned)', 'lsx-customizer'), |
|
218 | + 'top-menu-left' => esc_html__('Top Menu (left)', 'lsx-customizer'), |
|
219 | + 'top-menu-right' => esc_html__('Top Menu (right)', 'lsx-customizer'), |
|
220 | 220 | ), |
221 | - ) ) ); |
|
221 | + ))); |
|
222 | 222 | |
223 | - $wp_customize->add_setting( 'lsx_wc_cart_extra_html', array( |
|
223 | + $wp_customize->add_setting('lsx_wc_cart_extra_html', array( |
|
224 | 224 | 'default' => '', |
225 | 225 | 'sanitize_callback' => 'wp_kses_post', |
226 | - ) ); |
|
226 | + )); |
|
227 | 227 | |
228 | - $wp_customize->add_control( new LSX_Customizer_Wysiwyg_Control( $wp_customize, 'lsx_wc_cart_extra_html', array( |
|
229 | - 'label' => esc_html__( 'Extra HTML', 'lsx-customizer' ), |
|
230 | - 'description' => esc_html__( 'Extra HTML to display at cart page (bottom/left).', 'lsx-customizer' ), |
|
228 | + $wp_customize->add_control(new LSX_Customizer_Wysiwyg_Control($wp_customize, 'lsx_wc_cart_extra_html', array( |
|
229 | + 'label' => esc_html__('Extra HTML', 'lsx-customizer'), |
|
230 | + 'description' => esc_html__('Extra HTML to display at cart page (bottom/left).', 'lsx-customizer'), |
|
231 | 231 | 'section' => 'lsx-wc-cart', |
232 | 232 | 'settings' => 'lsx_wc_cart_extra_html', |
233 | 233 | 'priority' => 4, |
234 | 234 | 'type' => 'wysiwyg', |
235 | - ) ) ); |
|
235 | + ))); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * My Account. |
239 | 239 | */ |
240 | 240 | |
241 | - $wp_customize->add_section( 'lsx-wc-my-account', array( |
|
242 | - 'title' => esc_html__( 'LSX My Account', 'lsx-customizer' ), |
|
243 | - 'description' => esc_html__( 'Change the WooCommerce My Account settings.', 'lsx-customizer' ), |
|
241 | + $wp_customize->add_section('lsx-wc-my-account', array( |
|
242 | + 'title' => esc_html__('LSX My Account', 'lsx-customizer'), |
|
243 | + 'description' => esc_html__('Change the WooCommerce My Account settings.', 'lsx-customizer'), |
|
244 | 244 | 'panel' => 'woocommerce', |
245 | 245 | 'priority' => 4, |
246 | - ) ); |
|
246 | + )); |
|
247 | 247 | |
248 | - $wp_customize->add_setting( 'lsx_wc_my_account_menu_item', array( |
|
248 | + $wp_customize->add_setting('lsx_wc_my_account_menu_item', array( |
|
249 | 249 | 'default' => false, |
250 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
251 | - ) ); |
|
250 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
251 | + )); |
|
252 | 252 | |
253 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item', array( |
|
254 | - 'label' => esc_html__( 'Menu Item', 'lsx-customizer' ), |
|
255 | - 'description' => esc_html__( 'Enable the My Account menu item.', 'lsx-customizer' ), |
|
253 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_wc_my_account_menu_item', array( |
|
254 | + 'label' => esc_html__('Menu Item', 'lsx-customizer'), |
|
255 | + 'description' => esc_html__('Enable the My Account menu item.', 'lsx-customizer'), |
|
256 | 256 | 'section' => 'lsx-wc-my-account', |
257 | 257 | 'settings' => 'lsx_wc_my_account_menu_item', |
258 | 258 | 'type' => 'checkbox', |
259 | 259 | 'priority' => 1, |
260 | - ) ) ); |
|
260 | + ))); |
|
261 | 261 | |
262 | - $wp_customize->add_setting( 'lsx_wc_my_account_menu_item_style', array( |
|
262 | + $wp_customize->add_setting('lsx_wc_my_account_menu_item_style', array( |
|
263 | 263 | 'default' => 'extended', |
264 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
265 | - ) ); |
|
264 | + 'sanitize_callback' => array($this, 'sanitize_select'), |
|
265 | + )); |
|
266 | 266 | |
267 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item_style', array( |
|
268 | - 'label' => esc_html__( 'Menu Item Style', 'lsx-customizer' ), |
|
269 | - 'description' => esc_html__( 'WooCommerce menu item My Account style.', 'lsx-customizer' ), |
|
267 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_wc_my_account_menu_item_style', array( |
|
268 | + 'label' => esc_html__('Menu Item Style', 'lsx-customizer'), |
|
269 | + 'description' => esc_html__('WooCommerce menu item My Account style.', 'lsx-customizer'), |
|
270 | 270 | 'section' => 'lsx-wc-my-account', |
271 | 271 | 'settings' => 'lsx_wc_my_account_menu_item_style', |
272 | 272 | 'type' => 'select', |
273 | 273 | 'priority' => 2, |
274 | 274 | 'choices' => array( |
275 | - 'simple' => esc_html__( 'Simple', 'lsx-customizer' ), |
|
276 | - 'extended' => esc_html__( 'Extended', 'lsx-customizer' ), |
|
275 | + 'simple' => esc_html__('Simple', 'lsx-customizer'), |
|
276 | + 'extended' => esc_html__('Extended', 'lsx-customizer'), |
|
277 | 277 | ), |
278 | - ) ) ); |
|
278 | + ))); |
|
279 | 279 | |
280 | - $wp_customize->add_setting( 'lsx_wc_my_account_menu_item_position', array( |
|
280 | + $wp_customize->add_setting('lsx_wc_my_account_menu_item_position', array( |
|
281 | 281 | 'default' => 'main-menu-in', |
282 | - 'sanitize_callback' => array( $this, 'sanitize_select' ), |
|
283 | - ) ); |
|
282 | + 'sanitize_callback' => array($this, 'sanitize_select'), |
|
283 | + )); |
|
284 | 284 | |
285 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_wc_my_account_menu_item_position', array( |
|
286 | - 'label' => esc_html__( 'Menu Item Position', 'lsx-customizer' ), |
|
287 | - 'description' => esc_html__( 'WooCommerce menu item My Account position.', 'lsx-customizer' ), |
|
285 | + $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'lsx_wc_my_account_menu_item_position', array( |
|
286 | + 'label' => esc_html__('Menu Item Position', 'lsx-customizer'), |
|
287 | + 'description' => esc_html__('WooCommerce menu item My Account position.', 'lsx-customizer'), |
|
288 | 288 | 'section' => 'lsx-wc-my-account', |
289 | 289 | 'settings' => 'lsx_wc_my_account_menu_item_position', |
290 | 290 | 'type' => 'select', |
291 | 291 | 'priority' => 3, |
292 | 292 | 'choices' => array( |
293 | - 'main-menu-in' => esc_html__( 'Main Menu (as last item)', 'lsx-customizer' ), |
|
294 | - 'main-menu-out' => esc_html__( 'Main Menu (as last item, right aligned)', 'lsx-customizer' ), |
|
295 | - 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx-customizer' ), |
|
296 | - 'top-menu-right' => esc_html__( 'Top Menu (right)', 'lsx-customizer' ), |
|
293 | + 'main-menu-in' => esc_html__('Main Menu (as last item)', 'lsx-customizer'), |
|
294 | + 'main-menu-out' => esc_html__('Main Menu (as last item, right aligned)', 'lsx-customizer'), |
|
295 | + 'top-menu-left' => esc_html__('Top Menu (left)', 'lsx-customizer'), |
|
296 | + 'top-menu-right' => esc_html__('Top Menu (right)', 'lsx-customizer'), |
|
297 | 297 | ), |
298 | - ) ) ); |
|
298 | + ))); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -303,23 +303,23 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @since 1.1.1 |
305 | 305 | */ |
306 | - public function body_class( $classes ) { |
|
307 | - $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
308 | - $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
309 | - if ( is_checkout() ) { |
|
310 | - $layout = get_theme_mod( 'lsx_wc_checkout_layout', 'default' ); |
|
306 | + public function body_class($classes) { |
|
307 | + $distraction_free = get_theme_mod('lsx_distraction_free_checkout', false); |
|
308 | + $two_step_checkout = get_theme_mod('lsx_two_step_checkout', false); |
|
309 | + if (is_checkout()) { |
|
310 | + $layout = get_theme_mod('lsx_wc_checkout_layout', 'default'); |
|
311 | 311 | |
312 | - if ( 'default' === $layout ) { |
|
312 | + if ('default' === $layout) { |
|
313 | 313 | $classes[] = 'lsx-wc-checkout-layout-default'; |
314 | - } elseif ( 'stacked' === $layout ) { |
|
314 | + } elseif ('stacked' === $layout) { |
|
315 | 315 | $classes[] = 'lsx-wc-checkout-layout-stacked'; |
316 | - } elseif ( 'columns' === $layout ) { |
|
316 | + } elseif ('columns' === $layout) { |
|
317 | 317 | $classes[] = 'lsx-wc-checkout-layout-two-column-addreses'; |
318 | 318 | } |
319 | - if ( ! empty( $distraction_free ) ) { |
|
319 | + if ( ! empty($distraction_free)) { |
|
320 | 320 | $classes[] = 'lsx-wc-checkout-distraction-free'; |
321 | 321 | } |
322 | - if ( ! empty( $two_step_checkout ) ) { |
|
322 | + if ( ! empty($two_step_checkout)) { |
|
323 | 323 | $classes[] = 'lsx-wc-checkout-two-steps'; |
324 | 324 | } |
325 | 325 | } |
@@ -335,15 +335,15 @@ discard block |
||
335 | 335 | public function thankyou_page() { |
336 | 336 | global $wp; |
337 | 337 | |
338 | - if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { |
|
339 | - $thankyou_page = get_theme_mod( 'lsx_wc_checkout_thankyou_page', '0' ); |
|
338 | + if (is_checkout() && ! empty($wp->query_vars['order-received'])) { |
|
339 | + $thankyou_page = get_theme_mod('lsx_wc_checkout_thankyou_page', '0'); |
|
340 | 340 | |
341 | - if ( ! empty( $thankyou_page ) && ! is_page( $thankyou_page ) ) { |
|
342 | - $order_id = apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order-received'] ) ); |
|
343 | - $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ); |
|
341 | + if ( ! empty($thankyou_page) && ! is_page($thankyou_page)) { |
|
342 | + $order_id = apply_filters('woocommerce_thankyou_order_id', absint($wp->query_vars['order-received'])); |
|
343 | + $order_key = apply_filters('woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean($_GET['key'])); |
|
344 | 344 | |
345 | - if ( $order_id > 0 ) { |
|
346 | - wp_safe_redirect( get_permalink( $thankyou_page ) . '?order-received=' . $order_id . '&key=' . $order_key, 302 ); |
|
345 | + if ($order_id > 0) { |
|
346 | + wp_safe_redirect(get_permalink($thankyou_page) . '?order-received=' . $order_id . '&key=' . $order_key, 302); |
|
347 | 347 | exit; |
348 | 348 | } |
349 | 349 | } |
@@ -356,95 +356,95 @@ discard block |
||
356 | 356 | * @since 1.1.1 |
357 | 357 | */ |
358 | 358 | public function checkout_steps() { |
359 | - $cart_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
360 | - if ( ( is_checkout() || is_cart() ) && ! empty( get_theme_mod( 'lsx_checkout_steps', '1' ) ) ) : |
|
359 | + $cart_url = function_exists('wc_get_cart_url') ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
360 | + if ((is_checkout() || is_cart()) && ! empty(get_theme_mod('lsx_checkout_steps', '1'))) : |
|
361 | 361 | global $wp; |
362 | 362 | ?> |
363 | 363 | <div class="lsx-wc-checkout-steps"> |
364 | 364 | <ul class="lsx-wc-checkout-steps-items"> |
365 | 365 | |
366 | - <?php if ( is_cart() ) : ?> |
|
366 | + <?php if (is_cart()) : ?> |
|
367 | 367 | |
368 | 368 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done"> |
369 | - <a href="<?php echo esc_url( get_permalink( wc_get_page_id( 'shop' ) ) ); ?>" class="lsx-wc-checkout-steps-link"> |
|
369 | + <a href="<?php echo esc_url(get_permalink(wc_get_page_id('shop'))); ?>" class="lsx-wc-checkout-steps-link"> |
|
370 | 370 | <i class="fa fa-check-circle" aria-hidden="true"></i> |
371 | - <span><span><?php esc_html_e( 'Shop', 'lsx-customizer' ); ?></span></span> |
|
371 | + <span><span><?php esc_html_e('Shop', 'lsx-customizer'); ?></span></span> |
|
372 | 372 | </a> |
373 | 373 | |
374 | 374 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
375 | 375 | </li> |
376 | 376 | |
377 | 377 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-current lsx-wc-checkout-steps-item-cart"> |
378 | - <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e( '2', 'lsx-customizer' ); ?></i> |
|
379 | - <span><span><?php esc_html_e( 'My Cart', 'lsx-customizer' ); ?></span></span> |
|
378 | + <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e('2', 'lsx-customizer'); ?></i> |
|
379 | + <span><span><?php esc_html_e('My Cart', 'lsx-customizer'); ?></span></span> |
|
380 | 380 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
381 | 381 | </li> |
382 | 382 | |
383 | 383 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-disabled lsx-wc-checkout-steps-item-payment"> |
384 | - <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e( '3', 'lsx-customizer' ); ?></i> |
|
385 | - <span><span><?php esc_html_e( 'Billing details', 'lsx-customizer' ); ?></span></span> |
|
384 | + <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e('3', 'lsx-customizer'); ?></i> |
|
385 | + <span><span><?php esc_html_e('Billing details', 'lsx-customizer'); ?></span></span> |
|
386 | 386 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
387 | 387 | </li> |
388 | 388 | |
389 | 389 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-disabled lsx-wc-checkout-steps-item-thankyou"> |
390 | - <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e( '4', 'lsx-customizer' ); ?></i> |
|
391 | - <span><span><?php esc_html_e( 'Payment', 'lsx-customizer' ); ?></span></span> |
|
390 | + <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e('4', 'lsx-customizer'); ?></i> |
|
391 | + <span><span><?php esc_html_e('Payment', 'lsx-customizer'); ?></span></span> |
|
392 | 392 | </li> |
393 | 393 | |
394 | - <?php elseif ( is_checkout() && empty( $wp->query_vars['order-received'] ) ) : ?> |
|
394 | + <?php elseif (is_checkout() && empty($wp->query_vars['order-received'])) : ?> |
|
395 | 395 | |
396 | 396 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done"> |
397 | - <a href="<?php echo esc_url( get_permalink( wc_get_page_id( 'shop' ) ) ); ?>" class="lsx-wc-checkout-steps-link"> |
|
397 | + <a href="<?php echo esc_url(get_permalink(wc_get_page_id('shop'))); ?>" class="lsx-wc-checkout-steps-link"> |
|
398 | 398 | <i class="fa fa-check-circle" aria-hidden="true"></i> |
399 | - <span><span><?php esc_html_e( 'Shop', 'lsx-customizer' ); ?></span></span> |
|
399 | + <span><span><?php esc_html_e('Shop', 'lsx-customizer'); ?></span></span> |
|
400 | 400 | </a> |
401 | 401 | |
402 | 402 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
403 | 403 | </li> |
404 | 404 | |
405 | 405 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done lsx-wc-checkout-steps-item-cart"> |
406 | - <a href="<?php echo esc_url( $cart_url ); ?>" class="lsx-wc-checkout-steps-link"> |
|
406 | + <a href="<?php echo esc_url($cart_url); ?>" class="lsx-wc-checkout-steps-link"> |
|
407 | 407 | <i class="fa fa-check-circle" aria-hidden="true"></i> |
408 | - <span><span><?php esc_html_e( 'My Cart', 'lsx-customizer' ); ?></span></span> |
|
408 | + <span><span><?php esc_html_e('My Cart', 'lsx-customizer'); ?></span></span> |
|
409 | 409 | </a> |
410 | 410 | |
411 | 411 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
412 | 412 | </li> |
413 | 413 | |
414 | 414 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-current lsx-wc-checkout-steps-item-payment"> |
415 | - <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e( '3', 'lsx-customizer' ); ?></i> |
|
416 | - <span><span><?php esc_html_e( 'Billing details', 'lsx-customizer' ); ?></span></span> |
|
415 | + <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e('3', 'lsx-customizer'); ?></i> |
|
416 | + <span><span><?php esc_html_e('Billing details', 'lsx-customizer'); ?></span></span> |
|
417 | 417 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
418 | 418 | </li> |
419 | 419 | |
420 | 420 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-disabled lsx-wc-checkout-steps-item-thankyou"> |
421 | - <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e( '4', 'lsx-customizer' ); ?></i> |
|
422 | - <span><span><?php esc_html_e( 'Payment', 'lsx-customizer' ); ?></span></span> |
|
421 | + <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e('4', 'lsx-customizer'); ?></i> |
|
422 | + <span><span><?php esc_html_e('Payment', 'lsx-customizer'); ?></span></span> |
|
423 | 423 | </li> |
424 | 424 | |
425 | - <?php elseif ( is_checkout() ) : ?> |
|
425 | + <?php elseif (is_checkout()) : ?> |
|
426 | 426 | |
427 | 427 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done"> |
428 | 428 | <i class="fa fa-check-circle" aria-hidden="true"></i> |
429 | - <span><span><?php esc_html_e( 'Shop', 'lsx-customizer' ); ?></span></span> |
|
429 | + <span><span><?php esc_html_e('Shop', 'lsx-customizer'); ?></span></span> |
|
430 | 430 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
431 | 431 | </li> |
432 | 432 | |
433 | 433 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done lsx-wc-checkout-steps-item-cart"> |
434 | 434 | <i class="fa fa-check-circle" aria-hidden="true"></i> |
435 | - <span><span><?php esc_html_e( 'My Cart', 'lsx-customizer' ); ?></span></span> |
|
435 | + <span><span><?php esc_html_e('My Cart', 'lsx-customizer'); ?></span></span> |
|
436 | 436 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
437 | 437 | </li> |
438 | 438 | |
439 | 439 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done lsx-wc-checkout-steps-item-payment"> |
440 | 440 | <i class="fa fa-check-circle" aria-hidden="true"></i> |
441 | - <span><span><?php esc_html_e( 'Billing details', 'lsx-customizer' ); ?></span></span> |
|
441 | + <span><span><?php esc_html_e('Billing details', 'lsx-customizer'); ?></span></span> |
|
442 | 442 | <i class="fa fa-angle-right" aria-hidden="true"></i> |
443 | 443 | </li> |
444 | 444 | |
445 | 445 | <li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-current lsx-wc-checkout-steps-item-thankyou"> |
446 | - <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e( '4', 'lsx-customizer' ); ?></i> |
|
447 | - <span><span><?php esc_html_e( 'Payment', 'lsx-customizer' ); ?></span></span> |
|
446 | + <i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e('4', 'lsx-customizer'); ?></i> |
|
447 | + <span><span><?php esc_html_e('Payment', 'lsx-customizer'); ?></span></span> |
|
448 | 448 | </li> |
449 | 449 | |
450 | 450 | <?php endif; ?> |
@@ -461,11 +461,11 @@ discard block |
||
461 | 461 | * @since 1.1.1 |
462 | 462 | */ |
463 | 463 | public function checkout_extra_html() { |
464 | - if ( is_checkout() ) { |
|
465 | - $checkout_extra_html = get_theme_mod( 'lsx_wc_checkout_extra_html', '' ); |
|
464 | + if (is_checkout()) { |
|
465 | + $checkout_extra_html = get_theme_mod('lsx_wc_checkout_extra_html', ''); |
|
466 | 466 | |
467 | - if ( ! empty( $checkout_extra_html ) ) { |
|
468 | - add_action( 'woocommerce_review_order_after_payment', array( $this, 'checkout_extra_html_echo' ), 9 ); |
|
467 | + if ( ! empty($checkout_extra_html)) { |
|
468 | + add_action('woocommerce_review_order_after_payment', array($this, 'checkout_extra_html_echo'), 9); |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | } |
@@ -476,13 +476,13 @@ discard block |
||
476 | 476 | * @since 1.1.1 |
477 | 477 | */ |
478 | 478 | public function checkout_extra_html_echo() { |
479 | - if ( is_checkout() ) { |
|
480 | - $checkout_extra_html = get_theme_mod( 'lsx_wc_checkout_extra_html', '' ); |
|
479 | + if (is_checkout()) { |
|
480 | + $checkout_extra_html = get_theme_mod('lsx_wc_checkout_extra_html', ''); |
|
481 | 481 | |
482 | - if ( ! empty( $checkout_extra_html ) ) { |
|
482 | + if ( ! empty($checkout_extra_html)) { |
|
483 | 483 | ?> |
484 | 484 | <div class="lsx-wc-checkout-extra-html"> |
485 | - <?php echo wp_kses_post( $checkout_extra_html ); ?> |
|
485 | + <?php echo wp_kses_post($checkout_extra_html); ?> |
|
486 | 486 | </div> |
487 | 487 | <?php |
488 | 488 | } |
@@ -495,12 +495,12 @@ discard block |
||
495 | 495 | * @since 1.1.1 |
496 | 496 | */ |
497 | 497 | public function cart_extra_html() { |
498 | - if ( is_cart() ) { |
|
499 | - $cart_extra_html = get_theme_mod( 'lsx_wc_cart_extra_html', '' ); |
|
498 | + if (is_cart()) { |
|
499 | + $cart_extra_html = get_theme_mod('lsx_wc_cart_extra_html', ''); |
|
500 | 500 | |
501 | - if ( ! empty( $cart_extra_html ) ) { |
|
502 | - remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); |
|
503 | - add_action( 'woocommerce_cart_collaterals', array( $this, 'cart_extra_html_echo' ), 9 ); |
|
501 | + if ( ! empty($cart_extra_html)) { |
|
502 | + remove_action('woocommerce_cart_collaterals', 'woocommerce_cross_sell_display'); |
|
503 | + add_action('woocommerce_cart_collaterals', array($this, 'cart_extra_html_echo'), 9); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | } |
@@ -511,13 +511,13 @@ discard block |
||
511 | 511 | * @since 1.1.1 |
512 | 512 | */ |
513 | 513 | public function cart_extra_html_echo() { |
514 | - if ( is_cart() ) { |
|
515 | - $cart_extra_html = get_theme_mod( 'lsx_wc_cart_extra_html', '' ); |
|
514 | + if (is_cart()) { |
|
515 | + $cart_extra_html = get_theme_mod('lsx_wc_cart_extra_html', ''); |
|
516 | 516 | |
517 | - if ( ! empty( $cart_extra_html ) ) { |
|
517 | + if ( ! empty($cart_extra_html)) { |
|
518 | 518 | ?> |
519 | 519 | <div class="lsx-wc-cart-extra-html"> |
520 | - <?php echo wp_kses_post( $cart_extra_html ); ?> |
|
520 | + <?php echo wp_kses_post($cart_extra_html); ?> |
|
521 | 521 | </div> |
522 | 522 | <?php |
523 | 523 | } |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @since 1.1.1 |
531 | 531 | */ |
532 | - public function cart_menu_item_position( $menu_position ) { |
|
533 | - $position = get_theme_mod( 'lsx_wc_cart_menu_item_position', '' ); |
|
532 | + public function cart_menu_item_position($menu_position) { |
|
533 | + $position = get_theme_mod('lsx_wc_cart_menu_item_position', ''); |
|
534 | 534 | |
535 | - if ( ! empty( $position ) ) { |
|
536 | - switch ( $position ) { |
|
535 | + if ( ! empty($position)) { |
|
536 | + switch ($position) { |
|
537 | 537 | case 'main-menu-in': |
538 | 538 | case 'main-menu-out': |
539 | 539 | $menu_position = 'primary'; |
@@ -557,16 +557,16 @@ discard block |
||
557 | 557 | * |
558 | 558 | * @since 1.1.1 |
559 | 559 | */ |
560 | - public function cart_menu_item_class( $item_class ) { |
|
561 | - $position = get_theme_mod( 'lsx_wc_cart_menu_item_position', '' ); |
|
560 | + public function cart_menu_item_class($item_class) { |
|
561 | + $position = get_theme_mod('lsx_wc_cart_menu_item_position', ''); |
|
562 | 562 | |
563 | - if ( 'main-menu-out' === $position ) { |
|
563 | + if ('main-menu-out' === $position) { |
|
564 | 564 | $item_class .= ' lsx-wc-cart-menu-item-right-aligned'; |
565 | 565 | } |
566 | 566 | |
567 | - $style = get_theme_mod( 'lsx_wc_cart_menu_item_style', '' ); |
|
567 | + $style = get_theme_mod('lsx_wc_cart_menu_item_style', ''); |
|
568 | 568 | |
569 | - if ( 'simple' === $style ) { |
|
569 | + if ('simple' === $style) { |
|
570 | 570 | $item_class .= ' lsx-wc-cart-menu-item-simple'; |
571 | 571 | } |
572 | 572 | |
@@ -578,49 +578,49 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @since 1.1.1 |
580 | 580 | */ |
581 | - public function my_account_menu_item( $items, $args ) { |
|
582 | - $my_account_menu_item_position = apply_filters( 'lsx_wc_my_account_menu_item_position', 'primary' ); |
|
581 | + public function my_account_menu_item($items, $args) { |
|
582 | + $my_account_menu_item_position = apply_filters('lsx_wc_my_account_menu_item_position', 'primary'); |
|
583 | 583 | |
584 | - if ( $my_account_menu_item_position === $args->theme_location || ( 'primary_logged_out' === $args->theme_location && 'primary' === $my_account_menu_item_position ) ) { |
|
585 | - $customizer_option = get_theme_mod( 'lsx_wc_my_account_menu_item', false ); |
|
584 | + if ($my_account_menu_item_position === $args->theme_location || ('primary_logged_out' === $args->theme_location && 'primary' === $my_account_menu_item_position)) { |
|
585 | + $customizer_option = get_theme_mod('lsx_wc_my_account_menu_item', false); |
|
586 | 586 | |
587 | - if ( ! empty( $customizer_option ) ) { |
|
588 | - if ( is_account_page() ) { |
|
587 | + if ( ! empty($customizer_option)) { |
|
588 | + if (is_account_page()) { |
|
589 | 589 | $class = 'current-menu-item'; |
590 | 590 | } else { |
591 | 591 | $class = ''; |
592 | 592 | } |
593 | 593 | |
594 | 594 | $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-my-account-menu-item ' . $class; |
595 | - $item_class = apply_filters( 'lsx_wc_my_account_menu_item_class', $item_class ); |
|
595 | + $item_class = apply_filters('lsx_wc_my_account_menu_item_class', $item_class); |
|
596 | 596 | |
597 | 597 | $endpoints = WC()->query->get_query_vars(); |
598 | 598 | |
599 | - if ( is_user_logged_in() ) { |
|
599 | + if (is_user_logged_in()) { |
|
600 | 600 | $item = '<li class="' . $item_class . '">'; |
601 | - $item .= '<a title="' . esc_attr__( 'View your account', 'lsx-customizer' ) . '" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"><span>' . esc_attr__( 'My Account', 'lsx-customizer' ) . '</span></a>'; |
|
601 | + $item .= '<a title="' . esc_attr__('View your account', 'lsx-customizer') . '" href="' . esc_url(get_permalink(wc_get_page_id('myaccount'))) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"><span>' . esc_attr__('My Account', 'lsx-customizer') . '</span></a>'; |
|
602 | 602 | $item .= '<ul role="menu" class=" dropdown-menu lsx-wc-my-account-sub-menu">'; |
603 | - foreach ( wc_get_account_menu_items() as $endpoint => $label ) { |
|
603 | + foreach (wc_get_account_menu_items() as $endpoint => $label) { |
|
604 | 604 | $slug = $endpoint; |
605 | - if ( isset( $endpoints[ $endpoint ] ) && '' !== $endpoints[ $endpoint ] ) { |
|
606 | - $slug = $endpoints[ $endpoint ]; |
|
605 | + if (isset($endpoints[$endpoint]) && '' !== $endpoints[$endpoint]) { |
|
606 | + $slug = $endpoints[$endpoint]; |
|
607 | 607 | } |
608 | - if ( 'dashboard' === $slug ) { |
|
608 | + if ('dashboard' === $slug) { |
|
609 | 609 | $slug = ''; |
610 | 610 | } |
611 | - $item .= '<li class="menu-item"><a title="" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) . $slug ) . '">' . $label . '</a></li>'; |
|
611 | + $item .= '<li class="menu-item"><a title="" href="' . esc_url(get_permalink(wc_get_page_id('myaccount')) . $slug) . '">' . $label . '</a></li>'; |
|
612 | 612 | } |
613 | 613 | $item .= '</ul></li>'; |
614 | 614 | |
615 | 615 | } else { |
616 | 616 | $item = '<li class="' . $item_class . '">' . |
617 | - '<a title="' . esc_attr__( 'View your account', 'lsx-customizer' ) . '" href="' . esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) . '"><span>' . esc_attr__( 'Login', 'lsx-customizer' ) . '</span></a>' . |
|
617 | + '<a title="' . esc_attr__('View your account', 'lsx-customizer') . '" href="' . esc_url(get_permalink(wc_get_page_id('myaccount'))) . '"><span>' . esc_attr__('Login', 'lsx-customizer') . '</span></a>' . |
|
618 | 618 | '</li>'; |
619 | 619 | } |
620 | 620 | |
621 | - $item = apply_filters( 'lsx_wc_my_account_menu_item', $item ); |
|
621 | + $item = apply_filters('lsx_wc_my_account_menu_item', $item); |
|
622 | 622 | |
623 | - if ( 'top-menu' === $args->theme_location ) { |
|
623 | + if ('top-menu' === $args->theme_location) { |
|
624 | 624 | $items = $item . $items; |
625 | 625 | } else { |
626 | 626 | $items = $items . $item; |
@@ -636,11 +636,11 @@ discard block |
||
636 | 636 | * |
637 | 637 | * @since 1.1.1 |
638 | 638 | */ |
639 | - public function my_account_menu_item_position( $menu_position ) { |
|
640 | - $position = get_theme_mod( 'lsx_wc_my_account_menu_item_position', '' ); |
|
639 | + public function my_account_menu_item_position($menu_position) { |
|
640 | + $position = get_theme_mod('lsx_wc_my_account_menu_item_position', ''); |
|
641 | 641 | |
642 | - if ( ! empty( $position ) ) { |
|
643 | - switch ( $position ) { |
|
642 | + if ( ! empty($position)) { |
|
643 | + switch ($position) { |
|
644 | 644 | case 'main-menu-in': |
645 | 645 | case 'main-menu-out': |
646 | 646 | $menu_position = 'primary'; |
@@ -664,20 +664,20 @@ discard block |
||
664 | 664 | * |
665 | 665 | * @since 1.1.1 |
666 | 666 | */ |
667 | - public function my_account_menu_item_class( $item_class ) { |
|
668 | - $position = get_theme_mod( 'lsx_wc_my_account_menu_item_position', '' ); |
|
667 | + public function my_account_menu_item_class($item_class) { |
|
668 | + $position = get_theme_mod('lsx_wc_my_account_menu_item_position', ''); |
|
669 | 669 | |
670 | - if ( 'main-menu-out' === $position ) { |
|
670 | + if ('main-menu-out' === $position) { |
|
671 | 671 | $item_class .= ' lsx-wc-my-account-menu-item-right-aligned'; |
672 | 672 | } |
673 | 673 | |
674 | - if ( ! is_user_logged_in() ) { |
|
674 | + if ( ! is_user_logged_in()) { |
|
675 | 675 | $item_class .= ' lsx-wc-my-account-login'; |
676 | 676 | } |
677 | 677 | |
678 | - $style = get_theme_mod( 'lsx_wc_my_account_menu_item_style', '' ); |
|
678 | + $style = get_theme_mod('lsx_wc_my_account_menu_item_style', ''); |
|
679 | 679 | |
680 | - if ( 'simple' === $style ) { |
|
680 | + if ('simple' === $style) { |
|
681 | 681 | $item_class .= ' lsx-wc-my-account-menu-item-simple'; |
682 | 682 | } |
683 | 683 | |
@@ -688,13 +688,13 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public function show_layout_switcher() { |
690 | 690 | $body_classes = get_body_class(); |
691 | - if ( in_array( 'post-type-archive-product', $body_classes ) ) { |
|
691 | + if (in_array('post-type-archive-product', $body_classes)) { |
|
692 | 692 | global $WC_List_Grid; |
693 | - if ( null !== $WC_List_Grid ) { |
|
694 | - remove_action( 'woocommerce_before_shop_loop', array( $WC_List_Grid, 'gridlist_toggle_button' ), 30 ); |
|
695 | - add_action( 'lsx_banner_inner_bottom', array( $this, 'shop_gridlist_toggle_button' ), 90 ); |
|
696 | - add_action( 'lsx_global_header_inner_bottom', array( $this, 'shop_gridlist_toggle_button' ), 90 ); |
|
697 | - wp_deregister_style( 'grid-list-button' ); |
|
693 | + if (null !== $WC_List_Grid) { |
|
694 | + remove_action('woocommerce_before_shop_loop', array($WC_List_Grid, 'gridlist_toggle_button'), 30); |
|
695 | + add_action('lsx_banner_inner_bottom', array($this, 'shop_gridlist_toggle_button'), 90); |
|
696 | + add_action('lsx_global_header_inner_bottom', array($this, 'shop_gridlist_toggle_button'), 90); |
|
697 | + wp_deregister_style('grid-list-button'); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | } |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | global $WC_List_Grid; |
706 | 706 | ?> |
707 | 707 | <div class="lsx-layout-switcher"> |
708 | - <span class="lsx-layout-switcher-label"><?php esc_html_e( 'Select view:', 'lsx-blog-customizer' ); ?></span> |
|
708 | + <span class="lsx-layout-switcher-label"><?php esc_html_e('Select view:', 'lsx-blog-customizer'); ?></span> |
|
709 | 709 | <?php $WC_List_Grid->gridlist_toggle_button(); ?> |
710 | 710 | </div> |
711 | 711 | <?php |
712 | 712 | } |
713 | - public function gridlist_toggle_button_output( $output, $grid_view, $list_view ) { |
|
714 | - $output = sprintf( '<div class="gridlist-toggle lsx-layout-switcher-options"><a href="#" class="lsx-layout-switcher-option" id="grid" title="%1$s"><span class="fa fa fa-th"></span></a><a href="#" class="lsx-layout-switcher-option" id="list" title="%2$s"><span class="fa fa-bars"></span></a></div>', $grid_view, $list_view ); |
|
713 | + public function gridlist_toggle_button_output($output, $grid_view, $list_view) { |
|
714 | + $output = sprintf('<div class="gridlist-toggle lsx-layout-switcher-options"><a href="#" class="lsx-layout-switcher-option" id="grid" title="%1$s"><span class="fa fa fa-th"></span></a><a href="#" class="lsx-layout-switcher-option" id="list" title="%2$s"><span class="fa fa-bars"></span></a></div>', $grid_view, $list_view); |
|
715 | 715 | return $output; |
716 | 716 | } |
717 | 717 | } |
@@ -15,14 +15,14 @@ |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | // If this file is called directly, abort. |
18 | -if ( ! defined( 'WPINC' ) ) { |
|
18 | +if ( ! defined('WPINC')) { |
|
19 | 19 | die; |
20 | 20 | } |
21 | 21 | |
22 | -define( 'LSX_CUSTOMIZER_PATH', plugin_dir_path( __FILE__ ) ); |
|
23 | -define( 'LSX_CUSTOMIZER_CORE', __FILE__ ); |
|
24 | -define( 'LSX_CUSTOMIZER_URL', plugin_dir_url( __FILE__ ) ); |
|
25 | -define( 'LSX_CUSTOMIZER_VER', '1.5.0' ); |
|
22 | +define('LSX_CUSTOMIZER_PATH', plugin_dir_path(__FILE__)); |
|
23 | +define('LSX_CUSTOMIZER_CORE', __FILE__); |
|
24 | +define('LSX_CUSTOMIZER_URL', plugin_dir_url(__FILE__)); |
|
25 | +define('LSX_CUSTOMIZER_VER', '1.5.0'); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /* ======================= Below is the Plugin Class init ========================= */ |