PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.15.0
Shortcodes and extra features for Phlox theme v2.15.0
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / general-hooks.php
auxin-elements / includes Last commit date
classes 2 years ago compatibility 4 years ago elementor 2 years ago elements 2 years ago define.php 2 years ago general-functions.php 3 years ago general-hooks.php 2 years ago general-shortcodes.php 4 years ago index.php 3 years ago
general-hooks.php
3303 lines
1 <?php
2 /**
3 * Before Single Products Summary Div
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2023 averta
11 */
12
13
14
15 /**
16 * Adds a mian css class indicator to body tag
17 *
18 * @param array $classes List of body css classes
19 * @return array The modified list of body css classes
20 */
21 function auxels_body_class( $classes ) {
22 $classes[] = '_auxels';
23
24 if ( auxin_get_option('page_animation_nav_enable') && class_exists( '\Elementor\Plugin' ) && \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
25 unset( $classes[ array_search( 'aux-page-animation', $classes ) ] );
26 unset( $classes[ array_search( 'aux-page-animation-' . esc_attr( auxin_get_option('page_animation_nav_type', 'fade') ), $classes ) ] );
27 }
28
29 return $classes;
30 }
31 add_filter( 'body_class', 'auxels_body_class', 13 );
32
33
34 function auxin_add_theme_options_in_plugin( $fields_sections_list ){
35
36 // Sub section - Custom JS ------------------------------------
37
38 $fields_sections_list['sections'][] = array(
39 'id' => 'general-section-custom-js',
40 'parent' => 'general-section', // section parent's id
41 'title' => __( 'Custom JS Code', 'auxin-elements'),
42 'description' => __( 'Your Custom Javascript', 'auxin-elements')
43 );
44
45 $fields_sections_list['fields'][] = array(
46 'title' => __('Custom Javascript in Head', 'auxin-elements'),
47 'description' => sprintf( __('You can add your custom javascript code here.%s DO NOT use %s tag.', 'auxin-elements'), '<br />' , '<code>&lt;script&gt;</code>' )."<br />".
48 __('In order to save your custom javascript code, you are expected to execute the code prior to saving.', 'auxin-elements'),
49 'id' => 'auxin_user_custom_js_head',
50 'section' => 'general-section-custom-js',
51 'dependency' => array(),
52 'default' => '',
53 'transport' => 'postMessage',
54 'button_labels' => array( 'label' => __('Execute', 'auxin-elements') ),
55 'mode' => 'javascript',
56 'type' => 'code'
57 );
58
59 $fields_sections_list['fields'][] = array(
60 'title' => __('Custom Javascript in Footer', 'auxin-elements'),
61 'description' => sprintf( __('You can add your custom javascript code here.%s DO NOT use %s tag.', 'auxin-elements'), '<br />' , '<code>&lt;script&gt;</code>' )."<br />".
62 __('In order to save your custom javascript code, you are expected to execute the code prior to saving.', 'auxin-elements'),
63 'id' => 'auxin_user_custom_js',
64 'section' => 'general-section-custom-js',
65 'dependency' => array(),
66 'default' => '',
67 'transport' => 'postMessage',
68 'button_labels' => array( 'label' => __('Execute', 'auxin-elements') ),
69 'mode' => 'javascript',
70 'type' => 'code'
71 );
72
73
74 // Sub section - SEO ----------------------------------
75
76 $fields_sections_list['sections'][] = array(
77 'id' => 'general-section-seo',
78 'parent' => 'general-section', // section parent's id
79 'title' => __( 'Google API Keys & SEO', 'auxin-elements'),
80 'description' => __( 'Google API Keys & SEO', 'auxin-elements')
81 );
82
83
84 $fields_sections_list['fields'][] = array(
85 'title' => __('Built in SEO', 'auxin-elements'),
86 'description' => __('In case of using SEO plugins like "WordPress SEO by Yoast" or "All in One SEO Pack" you can disable built-in SEO for maximum compatibility.',
87 'auxin-elements'),
88 'id' => 'enable_theme_seo',
89 'section' => 'general-section-seo',
90 'dependency' => array(),
91 'default' => '1',
92 'type' => 'switch'
93 );
94
95 $fields_sections_list['fields'][] = array(
96 'title' => __('Google Analytics Code', 'auxin-elements'),
97 'description' => sprintf( __('You can %s set up Analytics tracking %s and add the tracking ID here.', 'auxin-elements'),
98 '<a href="https://support.google.com/analytics/answer/1008080" target="_blank">',
99 '</a>' ),
100 'id' => 'auxin_user_google_analytics',
101 'section' => 'general-section-seo',
102 'dependency' => array(),
103 'default' => '',
104 'transport' => 'postMessage',
105 'mode' => 'javascript',
106 'button_labels' => array( 'label' => false ),
107 'type' => 'text'
108 );
109
110 $fields_sections_list['fields'][] = array(
111 'title' => __('Google Maps API Key', 'auxin-elements'),
112 'description' => sprintf(
113 __( 'In order to use google maps on your website, you have to %s create an api key %s and insert it in this field.', 'auxin-elements' ),
114 '<a href="https://developers.google.com/maps/documentation/javascript/" target="_blank">',
115 '</a>'
116 ),
117 'id' => 'auxin_google_map_api_key',
118 'section' => 'general-section-seo',
119 'dependency' => array(),
120 'default' => '',
121 'transport' => 'postMessage',
122 'mode' => 'javascript',
123 'type' => 'text'
124 );
125
126 $fields_sections_list['fields'][] = array(
127 'title' => __('Google Marketing Code', 'auxin-elements'),
128 'description' => sprintf( __('You can add your Google marketing code here.%s DO NOT use %s tag.', 'auxin-elements'), '<br />' , '<code>&lt;script&gt;</code>' ),
129 'id' => 'auxin_user_google_marketing',
130 'section' => 'general-section-seo',
131 'dependency' => array(),
132 'default' => '',
133 'transport' => 'postMessage',
134 'mode' => 'javascript',
135 'button_labels' => array( 'label' => false ),
136 'type' => 'code'
137 );
138
139 // Secondary logo for sticky header ----------------------------------
140
141
142 $custom_logo_args = get_theme_support( 'custom-logo' );
143
144 $fields_sections_list['fields'][] = array(
145 'title' => __( 'Logo 2 (optional)', 'auxin-elements' ),
146 'description' => __( 'The secondary logo which appears when the header becomes sticky (optional).', 'auxin-elements' ),
147 'id' => 'custom_logo2',
148 'section' => 'title_tagline',
149 'transport' => 'postMessage',
150 'default' => '',
151 'priority' => 9,
152 'type' => 'image',
153 'transport' => 'refresh'
154 );
155
156
157 // Sub section - Button 1 in header -------------------------------
158
159 $fields_sections_list['sections'][] = array(
160 'id' => 'header-section-action-button1',
161 'parent' => 'header-section', // section parent's id
162 'title' => __( 'Header Button 1', 'auxin-elements' ),
163 'description' => __( 'Setting for Header Button 1', 'auxin-elements' ),
164 'is_deprecated' => true,
165 'dependency' => array(
166 array(
167 'id' => 'site_header_use_legacy',
168 'value' => '1',
169 'operator'=> '=='
170 )
171 )
172 );
173
174 $fields_sections_list['fields'][] = array(
175 'title' => __( 'Use Legacy Header', 'auxin-elements' ),
176 'description' => __( 'Disable it to replace header section with an Elementor template', 'auxin-elements' ),
177 'id' => 'site_header_btn1_section_use_legacy',
178 'section' => 'header-section-action-button1',
179 'type' => 'switch',
180 'default' => '0',
181 'related_controls' => ['site_header_use_legacy']
182 );
183
184 $fields_sections_list['fields'][] = array(
185 'title' => __('Display Header Button 1','auxin-elements' ),
186 'description' => __('Enable this option to display a button in header.','auxin-elements' ),
187 'section' => 'header-section-action-button1',
188 'id' => 'site_header_show_btn1',
189 'type' => 'switch',
190 'default' => '0',
191 'dependency' => array(
192 array(
193 'id' => 'site_header_use_legacy',
194 'value' => '1',
195 'operator'=> '=='
196 ),
197 ),
198 'partial' => array(
199 'selector' => '.aux-btn1-box',
200 'container_inclusive' => true,
201 'render_callback' => function(){ echo auxin_get_header_button(1); }
202 )
203 );
204
205 $fields_sections_list['fields'][] = array(
206 'title' => __( 'Hide Button 1 on Tablet', 'auxin-elements' ),
207 'description' => __( 'Enable it to hide header button 1 on tablet devices.', 'auxin-elements' ),
208 'id' => 'site_header_show_btn1_on_tablet',
209 'section' => 'header-section-action-button1',
210 'dependency' => array(
211 array(
212 'id' => 'site_header_show_btn1',
213 'value' => array('1'),
214 'operator'=> ''
215 ),
216 array(
217 'id' => 'site_header_use_legacy',
218 'value' => '1',
219 'operator'=> '=='
220 ),
221 ),
222 'default' => '1',
223 'transport' => 'postMessage',
224 'post_js' => '$(".aux-btn1-box").toggleClass( "aux-tablet-off", to );',
225 'type' => 'switch'
226 );
227
228 $fields_sections_list['fields'][] = array(
229 'title' => __( 'Hide Button 1 on Mobile', 'auxin-elements' ),
230 'description' => __( 'Enable it to hide header button 1 on tablet devices.', 'auxin-elements' ),
231 'id' => 'site_header_show_btn1_on_phone',
232 'section' => 'header-section-action-button1',
233 'dependency' => array(
234 array(
235 'id' => 'site_header_show_btn1',
236 'value' => array('1'),
237 'operator'=> ''
238 ),
239 array(
240 'id' => 'site_header_use_legacy',
241 'value' => '1',
242 'operator'=> '=='
243 ),
244 ),
245 'default' => '1',
246 'transport' => 'postMessage',
247 'post_js' => '$(".aux-btn1-box").toggleClass( "aux-phone-off", to );',
248 'type' => 'switch'
249 );
250
251 $fields_sections_list['fields'][] = array(
252 'title' => __('Button Label','auxin-elements' ),
253 'description' => __('Specifies the label of button.','auxin-elements' ),
254 'section' => 'header-section-action-button1',
255 'id' => 'site_header_btn1_label',
256 'type' => 'text',
257 'default' => __('Button', 'auxin-elements'),
258 'dependency' => array(
259 array(
260 'id' => 'site_header_show_btn1',
261 'value' => '1',
262 'operator'=> '=='
263 ),
264 array(
265 'id' => 'site_header_use_legacy',
266 'value' => '1',
267 'operator'=> '=='
268 ),
269 ),
270 'transport' => 'postMessage',
271 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").html( to );'
272 );
273
274 $fields_sections_list['fields'][] = array(
275 'title' => __('Button Size','auxin-elements' ),
276 'description' => '',
277 'section' => 'header-section-action-button1',
278 'id' => 'site_header_btn1_size',
279 'type' => 'select',
280 'choices' => array(
281 'exlarge' => __('Exlarge', 'auxin-elements' ),
282 'large' => __('Large' , 'auxin-elements' ),
283 'medium' => __('Medium' , 'auxin-elements' ),
284 'small' => __('Small' , 'auxin-elements' ),
285 'tiny' => __('Tiny' , 'auxin-elements' )
286 ),
287 'default' => 'large',
288 'dependency' => array(
289 array(
290 'id' => 'site_header_show_btn1',
291 'value' => '1',
292 'operator'=> '=='
293 ),
294 array(
295 'id' => 'site_header_use_legacy',
296 'value' => '1',
297 'operator'=> '=='
298 ),
299 ),
300 'transport' => 'postMessage',
301 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").removeClass( "aux-exlarge aux-large aux-medium aux-small aux-tiny" ).addClass( "aux-" + to );'
302 );
303
304 $fields_sections_list['fields'][] = array(
305 'title' => __('Button Shape','auxin-elements' ),
306 'description' => '',
307 'section' => 'header-section-action-button1',
308 'id' => 'site_header_btn1_shape',
309 'type' => 'radio-image',
310 'choices' => array(
311 '' => array(
312 'label' => __('Sharp', 'auxin-elements' ),
313 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
314 ),
315 'round' => array(
316 'label' => __('Round', 'auxin-elements' ),
317 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
318 ),
319 'curve' => array(
320 'label' => __('Curve', 'auxin-elements' ),
321 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
322 )
323 ),
324 'default' => 'curve',
325 'dependency' => array(
326 array(
327 'id' => 'site_header_show_btn1',
328 'value' => '1',
329 'operator'=> '=='
330 ),
331 array(
332 'id' => 'site_header_use_legacy',
333 'value' => '1',
334 'operator'=> '=='
335 ),
336 ),
337 'transport' => 'postMessage',
338 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").removeClass( "aux-round aux-curve" ).addClass( "aux-" + to );'
339 );
340
341 $fields_sections_list['fields'][] = array(
342 'title' => __('Button Style','auxin-elements' ),
343 'description' => '',
344 'section' => 'header-section-action-button1',
345 'id' => 'site_header_btn1_style',
346 'type' => 'radio-image',
347 'choices' => array(
348 '' => array(
349 'label' => __('Normal', 'auxin-elements' ),
350 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
351 ),
352 '3d' => array(
353 'label' => __('3D', 'auxin-elements' ),
354 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg'
355 ),
356 'outline' => array(
357 'label' => __('Outline', 'auxin-elements' ),
358 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg'
359 )
360 ),
361 'default' => '',
362 'dependency' => array(
363 array(
364 'id' => 'site_header_show_btn1',
365 'value' => '1',
366 'operator'=> '=='
367 ),
368 array(
369 'id' => 'site_header_use_legacy',
370 'value' => '1',
371 'operator'=> '=='
372 ),
373 ),
374 'transport' => 'postMessage',
375 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").removeClass( "aux-3d aux-outline" ).addClass( "aux-" + to );'
376 );
377
378 $fields_sections_list['fields'][] = array(
379 'title' => __( 'Button Typography', 'auxin-elements' ),
380 'id' => 'site_header_btn1_typography',
381 'section' => 'header-section-action-button1',
382 'default' => '',
383 'type' => 'group_typography',
384 'selectors' => '.site-header-section .aux-btn1-box .aux-button',
385 'dependency' => array(
386 array(
387 'id' => 'site_header_show_btn1',
388 'value' => '1',
389 'operator'=> '=='
390 ),
391 array(
392 'id' => 'site_header_use_legacy',
393 'value' => '1',
394 'operator'=> '=='
395 ),
396 ),
397 'transport' => 'postMessage'
398 );
399
400 $fields_sections_list['fields'][] = array(
401 'title' => __('Icon for Button','auxin-elements' ),
402 'description' => '',
403 'section' => 'header-section-action-button1',
404 'id' => 'site_header_btn1_icon',
405 'type' => 'icon',
406 'default' => '',
407 'dependency' => array(
408 array(
409 'id' => 'site_header_show_btn1',
410 'value' => '1',
411 'operator'=> '=='
412 ),
413 array(
414 'id' => 'site_header_use_legacy',
415 'value' => '1',
416 'operator'=> '=='
417 ),
418 ),
419 'transport' => 'refresh'
420 );
421
422 $fields_sections_list['fields'][] = array(
423 'title' => __('Icon Alignment','auxin-elements' ),
424 'description' => '',
425 'section' => 'header-section-action-button1',
426 'id' => 'site_header_btn1_icon_align',
427 'type' => 'radio-image',
428 'choices' => array(
429 'default' => array(
430 'label' => __('Default' , 'auxin-elements'),
431 'image' => AUXELS_ADMIN_URL . '/assets/images/button.png'
432 ),
433 'left' => array(
434 'label' => __('Left' , 'auxin-elements'),
435 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm'
436 ),
437 'right' => array(
438 'label' => __('Right' , 'auxin-elements'),
439 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button1.webm webm'
440 ),
441 'over' => array(
442 'label' => __('Over', 'auxin-elements'),
443 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button5.webm webm'
444 ),
445 'left-animate' => array(
446 'label' => __('Animate from Left', 'auxin-elements'),
447 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button4.webm webm'
448 ),
449 'right-animate' => array(
450 'label' => __('Animate from Righ', 'auxin-elements'),
451 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button3.webm webm'
452 )
453 ),
454 'default' => 'default',
455 'dependency' => array(
456 array(
457 'id' => 'site_header_show_btn1',
458 'value' => '1',
459 'operator'=> '=='
460 ),
461 array(
462 'id' => 'site_header_use_legacy',
463 'value' => '1',
464 'operator'=> '=='
465 ),
466 ),
467 'transport' => 'postMessage',
468 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").alterClass( "aux-icon-*", "aux-icon-" + to );'
469 );
470
471 $fields_sections_list['fields'][] = array(
472 'title' => __('Color of Button','auxin-elements' ),
473 'description' => '',
474 'section' => 'header-section-action-button1',
475 'id' => 'site_header_btn1_color_name',
476 'type' => 'radio-image',
477 'choices' => auxin_get_famous_colors_list(),
478 'default' => 'ball-blue',
479 'dependency' => array(
480 array(
481 'id' => 'site_header_show_btn1',
482 'value' => '1',
483 'operator'=> '=='
484 ),
485 array(
486 'id' => 'site_header_use_legacy',
487 'value' => '1',
488 'operator'=> '=='
489 ),
490 ),
491 'transport' => 'refresh'
492 );
493
494 $fields_sections_list['fields'][] = array(
495 'title' => __('Color of Button on Sticky','auxin-elements' ),
496 'description' => __('Specifies the color of the button when the header sticky is enabled.', 'auxin-elements' ),
497 'section' => 'header-section-action-button1',
498 'id' => 'site_header_btn1_color_name_on_sticky',
499 'type' => 'radio-image',
500 'choices' => auxin_get_famous_colors_list(),
501 'default' => 'ball-blue',
502 'dependency' => array(
503 array(
504 'id' => 'site_header_show_btn1',
505 'value' => '1',
506 'operator'=> '=='
507 ),
508 array(
509 'id' => 'site_header_use_legacy',
510 'value' => '1',
511 'operator'=> '=='
512 ),
513 ),
514 'transport' => 'refresh'
515 );
516
517 $fields_sections_list['fields'][] = array(
518 'title' => __('Button Link','auxin-elements' ),
519 'description' => '',
520 'section' => 'header-section-action-button1',
521 'id' => 'site_header_btn1_link',
522 'type' => 'text',
523 'default' => '#',
524 'dependency' => array(
525 array(
526 'id' => 'site_header_show_btn1',
527 'value' => '1',
528 'operator'=> '=='
529 ),
530 array(
531 'id' => 'site_header_use_legacy',
532 'value' => '1',
533 'operator'=> '=='
534 ),
535 ),
536 'transport' => 'postMessage',
537 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").prop( "href", to );'
538 );
539
540 $fields_sections_list['fields'][] = array(
541 'title' => __('Open Link in','auxin-elements' ),
542 'description' => '',
543 'section' => 'header-section-action-button1',
544 'id' => 'site_header_btn1_target',
545 'type' => 'select',
546 'choices' => array(
547 '_self' => __('Current page' , 'auxin-elements' ),
548 '_blank' => __('New page', 'auxin-elements' )
549 ),
550 'default' => '_self',
551 'dependency' => array(
552 array(
553 'id' => 'site_header_show_btn1',
554 'value' => '1',
555 'operator'=> '=='
556 ),
557 array(
558 'id' => 'site_header_use_legacy',
559 'value' => '1',
560 'operator'=> '=='
561 ),
562 ),
563 'transport' => 'postMessage',
564 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").prop( "target", to );'
565 );
566
567
568
569 // Sub section - Button 2 in header -------------------------------
570
571 $fields_sections_list['sections'][] = array(
572 'id' => 'header-section-action-button2',
573 'parent' => 'header-section', // section parent's id
574 'title' => __( 'Header Button 2', 'auxin-elements' ),
575 'description' => __( 'Setting for Header Button 2', 'auxin-elements' ),
576 'is_deprecated' => true,
577 'dependency' => array(
578 array(
579 'id' => 'site_header_use_legacy',
580 'value' => '1',
581 'operator'=> '=='
582 )
583 )
584 );
585
586 $fields_sections_list['fields'][] = array(
587 'title' => __( 'Use Legacy Header', 'auxin-elements' ),
588 'description' => __( 'Disable it to replace header section with an Elementor template', 'auxin-elements' ),
589 'id' => 'site_header_btn2_section_use_legacy',
590 'section' => 'header-section-action-button2',
591 'type' => 'switch',
592 'default' => '0',
593 'related_controls' => ['site_header_use_legacy']
594 );
595
596 $fields_sections_list['fields'][] = array(
597 'title' => __('Display Header Button 2','auxin-elements' ),
598 'description' => __('Enable this option to display a button in header.','auxin-elements' ),
599 'section' => 'header-section-action-button2',
600 'id' => 'site_header_show_btn2',
601 'type' => 'switch',
602 'default' => '0',
603 'dependency' => array(
604 array(
605 'id' => 'site_header_use_legacy',
606 'value' => '1',
607 'operator'=> '=='
608 ),
609 ),
610 'partial' => array(
611 'selector' => '.aux-btn2-box',
612 'container_inclusive' => true,
613 'render_callback' => function(){ echo auxin_get_header_button(2); }
614 )
615 );
616
617 $fields_sections_list['fields'][] = array(
618 'title' => __( 'Hide Button 2 on Tablet', 'auxin-elements' ),
619 'description' => __( 'Enable it to hide header button 2 on tablet devices.', 'auxin-elements' ),
620 'id' => 'site_header_show_btn2_on_tablet',
621 'section' => 'header-section-action-button2',
622 'dependency' => array(
623 array(
624 'id' => 'site_header_show_btn2',
625 'value' => array('1'),
626 'operator'=> ''
627 ),
628 array(
629 'id' => 'site_header_use_legacy',
630 'value' => '1',
631 'operator'=> '=='
632 ),
633 ),
634 'default' => '1',
635 'transport' => 'postMessage',
636 'post_js' => '$(".aux-btn2-box").toggleClass( "aux-tablet-off", to );',
637 'type' => 'switch'
638 );
639
640 $fields_sections_list['fields'][] = array(
641 'title' => __( 'Hide Button 2 on Mobile', 'auxin-elements' ),
642 'description' => __( 'Enable it to hide header button 2 on tablet devices.', 'auxin-elements' ),
643 'id' => 'site_header_show_btn2_on_phone',
644 'section' => 'header-section-action-button2',
645 'dependency' => array(
646 array(
647 'id' => 'site_header_show_btn2',
648 'value' => array('1'),
649 'operator'=> ''
650 ),
651 array(
652 'id' => 'site_header_use_legacy',
653 'value' => '1',
654 'operator'=> '=='
655 ),
656 ),
657 'default' => '1',
658 'transport' => 'postMessage',
659 'post_js' => '$(".aux-btn2-box").toggleClass( "aux-phone-off", to );',
660 'type' => 'switch'
661 );
662
663 $fields_sections_list['fields'][] = array(
664 'title' => __('Button Label','auxin-elements' ),
665 'description' => __('Specifies the label of button.','auxin-elements' ),
666 'section' => 'header-section-action-button2',
667 'id' => 'site_header_btn2_label',
668 'type' => 'text',
669 'default' => __('Button', 'auxin-elements'),
670 'dependency' => array(
671 array(
672 'id' => 'site_header_show_btn2',
673 'value' => 1,
674 'operator'=> '=='
675 ),
676 array(
677 'id' => 'site_header_use_legacy',
678 'value' => '1',
679 'operator'=> '=='
680 ),
681 ),
682 'transport' => 'postMessage',
683 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").html( to );'
684 );
685
686 $fields_sections_list['fields'][] = array(
687 'title' => __('Button Size','auxin-elements' ),
688 'description' => '',
689 'section' => 'header-section-action-button2',
690 'id' => 'site_header_btn2_size',
691 'type' => 'select',
692 'choices' => array(
693 'exlarge' => __('Exlarge', 'auxin-elements' ),
694 'large' => __('Large' , 'auxin-elements' ),
695 'medium' => __('Medium' , 'auxin-elements' ),
696 'small' => __('Small' , 'auxin-elements' ),
697 'tiny' => __('Tiny' , 'auxin-elements' )
698 ),
699 'default' => 'large',
700 'dependency' => array(
701 array(
702 'id' => 'site_header_show_btn2',
703 'value' => 1,
704 'operator'=> '=='
705 ),
706 array(
707 'id' => 'site_header_use_legacy',
708 'value' => '1',
709 'operator'=> '=='
710 ),
711 ),
712 'transport' => 'postMessage',
713 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").removeClass( "aux-exlarge aux-large aux-medium aux-small aux-tiny" ).addClass( "aux-" + to );'
714 );
715
716 $fields_sections_list['fields'][] = array(
717 'title' => __('Button Shape','auxin-elements' ),
718 'description' => '',
719 'section' => 'header-section-action-button2',
720 'id' => 'site_header_btn2_shape',
721 'type' => 'radio-image',
722 'choices' => array(
723 '' => array(
724 'label' => __('Sharp', 'auxin-elements' ),
725 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
726 ),
727 'round' => array(
728 'label' => __('Round', 'auxin-elements' ),
729 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
730 ),
731 'curve' => array(
732 'label' => __('Curve', 'auxin-elements' ),
733 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
734 )
735 ),
736 'default' => 'curve',
737 'dependency' => array(
738 array(
739 'id' => 'site_header_show_btn2',
740 'value' => 1,
741 'operator'=> '=='
742 ),
743 array(
744 'id' => 'site_header_use_legacy',
745 'value' => '1',
746 'operator'=> '=='
747 ),
748 ),
749 'transport' => 'postMessage',
750 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").removeClass( "aux-round aux-curve" ).addClass( "aux-" + to );'
751 );
752
753 $fields_sections_list['fields'][] = array(
754 'title' => __('Button Style','auxin-elements' ),
755 'description' => '',
756 'section' => 'header-section-action-button2',
757 'id' => 'site_header_btn2_style',
758 'type' => 'radio-image',
759 'choices' => array(
760 '' => array(
761 'label' => __('Normal', 'auxin-elements' ),
762 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
763 ),
764 '3d' => array(
765 'label' => __('3D', 'auxin-elements' ),
766 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg'
767 ),
768 'outline' => array(
769 'label' => __('Outline', 'auxin-elements' ),
770 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg'
771 )
772 ),
773 'default' => 'outline',
774 'dependency' => array(
775 array(
776 'id' => 'site_header_show_btn2',
777 'value' => 1,
778 'operator'=> '=='
779 ),
780 array(
781 'id' => 'site_header_use_legacy',
782 'value' => '1',
783 'operator'=> '=='
784 ),
785 ),
786 'transport' => 'postMessage',
787 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").removeClass( "aux-3d aux-outline" ).addClass( "aux-" + to );'
788 );
789
790 $fields_sections_list['fields'][] = array(
791 'title' => __( 'Button Typography', 'auxin-elements' ),
792 'id' => 'site_header_btn2_typography',
793 'section' => 'header-section-action-button2',
794 'default' => '',
795 'type' => 'group_typography',
796 'selectors' => '.site-header-section .aux-btn2-box .aux-button',
797 'dependency' => array(
798 array(
799 'id' => 'site_header_show_btn2',
800 'value' => '1',
801 'operator'=> '=='
802 ),
803 array(
804 'id' => 'site_header_use_legacy',
805 'value' => '1',
806 'operator'=> '=='
807 ),
808 ),
809 'transport' => 'postMessage'
810 );
811
812 $fields_sections_list['fields'][] = array(
813 'title' => __('Icon for Button','auxin-elements' ),
814 'description' => '',
815 'section' => 'header-section-action-button2',
816 'id' => 'site_header_btn2_icon',
817 'type' => 'icon',
818 'default' => '',
819 'dependency' => array(
820 array(
821 'id' => 'site_header_show_btn2',
822 'value' => 1,
823 'operator'=> '=='
824 ),
825 array(
826 'id' => 'site_header_use_legacy',
827 'value' => '1',
828 'operator'=> '=='
829 ),
830 ),
831 'transport' => 'refresh'
832 );
833
834 $fields_sections_list['fields'][] = array(
835 'title' => __('Icon Alignment','auxin-elements' ),
836 'description' => '',
837 'section' => 'header-section-action-button2',
838 'id' => 'site_header_btn2_icon_align',
839 'type' => 'radio-image',
840 'choices' => array(
841 'default' => array(
842 'label' => __('Default' , 'auxin-elements'),
843 'image' => AUXELS_ADMIN_URL . '/assets/images/button.png'
844 ),
845 'left' => array(
846 'label' => __('Left' , 'auxin-elements'),
847 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm'
848 ),
849 'right' => array(
850 'label' => __('Right' , 'auxin-elements'),
851 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm'
852 ),
853 'over' => array(
854 'label' => __('Over', 'auxin-elements'),
855 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button5.webm webm'
856 ),
857 'left-animate' => array(
858 'label' => __('Animate from Left', 'auxin-elements'),
859 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button4.webm webm'
860 ),
861 'right-animate' => array(
862 'label' => __('Animate from Righ', 'auxin-elements'),
863 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button3.webm webm'
864 )
865 ),
866 'default' => 'default',
867 'dependency' => array(
868 array(
869 'id' => 'site_header_show_btn2',
870 'value' => 1,
871 'operator'=> '=='
872 ),
873 array(
874 'id' => 'site_header_use_legacy',
875 'value' => '1',
876 'operator'=> '=='
877 ),
878 ),
879 'transport' => 'postMessage',
880 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").alterClass( "aux-icon-*", "aux-icon-" + to );'
881 );
882
883 $fields_sections_list['fields'][] = array(
884 'title' => __('Color of Button','auxin-elements' ),
885 'description' => '',
886 'section' => 'header-section-action-button2',
887 'id' => 'site_header_btn2_color_name',
888 'type' => 'radio-image',
889 'choices' => auxin_get_famous_colors_list(),
890 'default' => 'emerald',
891 'dependency' => array(
892 array(
893 'id' => 'site_header_show_btn2',
894 'value' => 1,
895 'operator'=> '=='
896 ),
897 array(
898 'id' => 'site_header_use_legacy',
899 'value' => '1',
900 'operator'=> '=='
901 ),
902 ),
903 'transport' => 'refresh'
904 );
905
906 $fields_sections_list['fields'][] = array(
907 'title' => __('Color of Button on Sticky','auxin-elements' ),
908 'description' => __('Specifies the color of the button when the header sticky is enabled.', 'auxin-elements' ),
909 'section' => 'header-section-action-button2',
910 'id' => 'site_header_btn2_color_name_on_sticky',
911 'type' => 'radio-image',
912 'choices' => auxin_get_famous_colors_list(),
913 'default' => 'ball-blue',
914 'dependency' => array(
915 array(
916 'id' => 'site_header_show_btn2',
917 'value' => '1',
918 'operator'=> '=='
919 ),
920 array(
921 'id' => 'site_header_use_legacy',
922 'value' => '1',
923 'operator'=> '=='
924 ),
925 ),
926 'transport' => 'refresh'
927 );
928
929 $fields_sections_list['fields'][] = array(
930 'title' => __('Button Link','auxin-elements' ),
931 'description' => '',
932 'section' => 'header-section-action-button2',
933 'id' => 'site_header_btn2_link',
934 'type' => 'text',
935 'default' => '',
936 'dependency' => array(
937 array(
938 'id' => 'site_header_show_btn2',
939 'value' => 1,
940 'operator'=> '=='
941 ),
942 array(
943 'id' => 'site_header_use_legacy',
944 'value' => '1',
945 'operator'=> '=='
946 ),
947 ),
948 'transport' => 'postMessage',
949 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").prop( "href", to );'
950 );
951
952 $fields_sections_list['fields'][] = array(
953 'title' => __('Open Link in','auxin-elements' ),
954 'description' => '',
955 'section' => 'header-section-action-button2',
956 'id' => 'site_header_btn2_target',
957 'type' => 'select',
958 'choices' => array(
959 '_self' => __('Current page' , 'auxin-elements' ),
960 '_blank' => __('New page', 'auxin-elements' )
961 ),
962 'default' => '_self',
963 'dependency' => array(
964 array(
965 'id' => 'site_header_show_btn2',
966 'value' => 1,
967 'operator'=> '=='
968 ),
969 array(
970 'id' => 'site_header_use_legacy',
971 'value' => '1',
972 'operator'=> '=='
973 ),
974 ),
975 'transport' => 'postMessage',
976 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").prop( "target", to );'
977 );
978
979
980 // Sub section - footer -------------------------------
981
982
983 $fields_sections_list['fields'][] = array(
984 'title' => __('Footer Brand Image', 'auxin-elements'),
985 'description' => __('This image appears as site brand image on footer section.', 'auxin-elements'),
986 'id' => 'site_secondary_logo_image',
987 'section' => 'footer-section-footer',
988 'dependency' => array(
989 array(
990 'id' => 'show_site_footer',
991 'value' => array('1'),
992 'operator'=> '=='
993 ),
994 array(
995 'id' => 'site_footer_use_legacy',
996 'value' => array('1'),
997 'operator'=> '=='
998 )
999 ),
1000 'default' => '',
1001 'transport' => 'postMessage',
1002 'partial' => array(
1003 'selector' => '.aux-logo-footer .aux-logo-anchor',
1004 'container_inclusive' => false,
1005 'render_callback' => function(){ echo _auxin_get_footer_logo_image(); }
1006 ),
1007 'type' => 'image'
1008 );
1009
1010 $fields_sections_list['fields'][] = array(
1011 'title' => __('Footer Brand Height', 'auxin-elements'),
1012 'description' => __('Specifies maximum height of logo in footer.', 'auxin-elements'),
1013 'id' => 'site_secondary_logo_max_height',
1014 'section' => 'footer-section-footer',
1015 'dependency' => array(
1016 array(
1017 'id' => 'show_site_footer',
1018 'value' => array('1'),
1019 'operator'=> '=='
1020 ),
1021 array(
1022 'id' => 'site_footer_use_legacy',
1023 'value' => array('1'),
1024 'operator'=> '=='
1025 )
1026 ),
1027 'default' => '50',
1028 'transport' => 'postMessage',
1029 'post_js' => '$(".aux-logo-footer .aux-logo-anchor img").css( "max-height", $.trim(to) + "px" );',
1030 'style_callback' => function( $value = null ){
1031 if( ! $value ){
1032 $value = auxin_get_option( 'site_secondary_logo_max_height' );
1033 }
1034 $value = trim( $value, 'px');
1035 return $value ? ".aux-logo-footer .aux-logo-anchor img { max-height:{$value}px; }" : '';
1036 },
1037 'type' => 'text'
1038 );
1039
1040
1041
1042
1043 // Sub section - Login page customizer -------------------------------
1044
1045 $fields_sections_list['sections'][] = array(
1046 'id' => 'tools-section-login',
1047 'parent' => 'tools-section', // section parent's id
1048 'title' => __( 'Login Page', 'auxin-elements' ),
1049 'description' => __( 'Preview login page', 'auxin-elements' ),
1050 'preview_link' => wp_login_url()
1051 );
1052
1053
1054
1055 $fields_sections_list['fields'][] = array(
1056 'title' => __('Login Skin', 'auxin-elements'),
1057 'description' => __('Specifies a skin for login page of your website.', 'auxin-elements'),
1058 'id' => 'auxin_login_skin',
1059 'section' => 'tools-section-login',
1060 'dependency' => array(),
1061 'choices' => array(
1062 'default' => array(
1063 'label' => __('Default', 'auxin-elements'),
1064 'image' => AUXIN_URL . 'images/visual-select/login-skin-default.svg'
1065 ),
1066 'clean-white' => array(
1067 'label' => __('Clean white', 'auxin-elements'),
1068 'image' => AUXIN_URL . 'images/visual-select/login-skin-light.svg'
1069 ),
1070 'simple-white' => array(
1071 'label' => __('Simple white', 'auxin-elements'),
1072 'image' => AUXIN_URL . 'images/visual-select/login-skin-simple-light.svg'
1073 ),
1074 'simple-gray' => array(
1075 'label' => __('Simple gray', 'auxin-elements'),
1076 'image' => AUXIN_URL . 'images/visual-select/login-skin-simple-gray.svg'
1077 )
1078 ),
1079 'transport' => 'refresh',
1080 'default' => 'default',
1081 'type' => 'radio-image'
1082 );
1083
1084 $fields_sections_list['fields'][] = array(
1085 'title' => __('Login message', 'auxin-elements'),
1086 'description' => __('Enter a text to display above the login form.', 'auxin-elements'),
1087 'id' => 'auxin_login_message',
1088 'section' => 'tools-section-login',
1089 'dependency' => array(),
1090 'transport' => 'refresh',
1091 'type' => 'textarea',
1092 'default' => ''
1093 );
1094
1095 //--------------------------------
1096
1097 $fields_sections_list['fields'][] = array(
1098 'title' => __('Login Page Logo', 'auxin-elements'),
1099 'description' => __('Specifies a logo to display on login page.(width of logo image could be up to 320px)', 'auxin-elements'),
1100 'id' => 'auxin_login_logo_image',
1101 'section' => 'tools-section-login',
1102 'dependency' => array(),
1103 'transport' => 'refresh',
1104 'default' => '',
1105 'type' => 'image'
1106 );
1107
1108
1109 $fields_sections_list['fields'][] = array(
1110 'title' => __('Logo Width', 'auxin-elements'),
1111 'description' => __('Specifies width of logo image in pixel.', 'auxin-elements'),
1112 'id' => 'auxin_login_logo_width',
1113 'section' => 'tools-section-login',
1114 'dependency' => array(),
1115 'transport' => 'refresh',
1116 'default' => '84',
1117 'type' => 'text'
1118 );
1119
1120
1121 $fields_sections_list['fields'][] = array(
1122 'title' => __('Logo Height', 'auxin-elements'),
1123 'description' => __('Specifies height of logo image in pixel.', 'auxin-elements'),
1124 'id' => 'auxin_login_logo_height',
1125 'section' => 'tools-section-login',
1126 'dependency' => array(),
1127 'transport' => 'refresh',
1128 'default' => '84',
1129 'type' => 'text'
1130 );
1131
1132 //--------------------------------
1133
1134 $fields_sections_list['fields'][] = array(
1135 'title' => __('Enable Background', 'auxin-elements'),
1136 'description' => __('Enable it to display custom background on login page.', 'auxin-elements'),
1137 'id' => 'auxin_login_bg_show',
1138 'section' => 'tools-section-login',
1139 'type' => 'switch',
1140 'transport' => 'refresh',
1141 'wrapper_class' => 'collapse-head',
1142 'default' => '0'
1143 );
1144
1145
1146 $fields_sections_list['fields'][] = array(
1147 'title' => __( 'Background Color', 'auxin-elements'),
1148 'description' => __( 'Specifies background color of website.', 'auxin-elements'),
1149 'id' => 'auxin_login_bg_color',
1150 'section' => 'tools-section-login',
1151 'type' => 'color',
1152 'selectors' => ' ',
1153 'dependency' => array(
1154 array(
1155 'id' => 'auxin_login_bg_show',
1156 'value' => array( '1' )
1157 )
1158 ),
1159 'transport' => 'postMessage',
1160 'default' => ''
1161 );
1162
1163 $fields_sections_list['fields'][] = array(
1164 'title' => __('Background Image', 'auxin-elements'),
1165 'description' => __('You can upload custom image for background of login page', 'auxin-elements'),
1166 'id' => 'auxin_login_bg_image',
1167 'section' => 'tools-section-login',
1168 'type' => 'image',
1169 'dependency' => array(
1170 array(
1171 'id' => 'auxin_login_bg_show',
1172 'value' => array( '1' )
1173 )
1174 ),
1175 'transport' => 'refresh',
1176 'default' => ''
1177 );
1178
1179 $fields_sections_list['fields'][] = array(
1180 'title' => __('Background Size', 'auxin-elements'),
1181 'description' => __('Specifies background size on login page.', 'auxin-elements'),
1182 'id' => 'auxin_login_bg_size',
1183 'section' => 'tools-section-login',
1184 'type' => 'radio-image',
1185 'choices' => array(
1186 'auto' => array(
1187 'label' => __('Auto', 'auxin-elements'),
1188 'css_class' => 'axiAdminIcon-bg-size-1',
1189 ),
1190 'contain' => array(
1191 'label' => __('Contain', 'auxin-elements'),
1192 'css_class' => 'axiAdminIcon-bg-size-2'
1193 ),
1194 'cover' => array(
1195 'label' => __('Cover', 'auxin-elements'),
1196 'css_class' => 'axiAdminIcon-bg-size-3'
1197 )
1198 ),
1199 'dependency' => array(
1200 array(
1201 'id' => 'auxin_login_bg_show',
1202 'value' => array( '1' )
1203 )
1204 ),
1205 'transport' => 'refresh',
1206 'default' => 'auto'
1207 );
1208
1209 $fields_sections_list['fields'][] = array(
1210 'title' => __('Background Pattern', 'auxin-elements'),
1211 'description' => sprintf(__('You can select one of these patterns as login background image. %s Some of these can be used as a pattern over your background image.', 'auxin-elements'), '<br>'),
1212 'id' => 'auxin_login_bg_pattern',
1213 'section' => 'tools-section-login',
1214 'choices' => auxin_get_background_patterns( array( 'none' => array( 'label' =>__('None', 'auxin-elements'), 'image' => AUXIN_URL . 'images/visual-select/none-pattern.svg' ) ), 'before' ),
1215 'type' => 'radio-image',
1216 'dependency' => array(
1217 array(
1218 'id' => 'auxin_login_bg_show',
1219 'value' => array( '1' )
1220 )
1221 ),
1222 'transport' => 'refresh',
1223 'default' => ''
1224 );
1225
1226 $fields_sections_list['fields'][] = array(
1227 'title' => __( 'Background Repeat', 'auxin-elements'),
1228 'description' => __( 'Specifies how background image repeats.', 'auxin-elements'),
1229 'id' => 'auxin_login_bg_repeat',
1230 'section' => 'tools-section-login',
1231 'choices' => array(
1232 'no-repeat' => array(
1233 'label' => __('No repeat', 'auxin-elements'),
1234 'css_class' => 'axiAdminIcon-none',
1235 ),
1236 'repeat' => array(
1237 'label' => __('Repeat horizontally and vertically', 'auxin-elements'),
1238 'css_class' => 'axiAdminIcon-repeat-xy',
1239 ),
1240 'repeat-x' => array(
1241 'label' => __('Repeat horizontally', 'auxin-elements'),
1242 'css_class' => 'axiAdminIcon-repeat-x',
1243 ),
1244 'repeat-y' => array(
1245 'label' => __('Repeat vertically', 'auxin-elements'),
1246 'css_class' => 'axiAdminIcon-repeat-y',
1247 )
1248 ),
1249 'type' => 'radio-image',
1250 'dependency' => array(
1251 array(
1252 'id' => 'auxin_login_bg_show',
1253 'value' => array( '1' )
1254 )
1255 ),
1256 'transport' => 'refresh',
1257 'default' => 'no-repeat'
1258 );
1259
1260 $fields_sections_list['fields'][] = array(
1261 'title' => __( 'Background Position', 'auxin-elements'),
1262 'description' => __('Specifies background image position.', 'auxin-elements'),
1263 'id' => 'auxin_login_bg_position',
1264 'section' => 'tools-section-login',
1265 'choices' => array(
1266 'left top' => array(
1267 'label' => __('Left top', 'auxin-elements'),
1268 'css_class' => 'axiAdminIcon-top-left'
1269 ),
1270 'center top' => array(
1271 'label' => __('Center top', 'auxin-elements'),
1272 'css_class' => 'axiAdminIcon-top-center'
1273 ),
1274 'right top' => array(
1275 'label' => __('Right top', 'auxin-elements'),
1276 'css_class' => 'axiAdminIcon-top-right'
1277 ),
1278
1279 'left center' => array(
1280 'label' => __('Left center', 'auxin-elements'),
1281 'css_class' => 'axiAdminIcon-center-left'
1282 ),
1283 'center center' => array(
1284 'label' => __('Center center', 'auxin-elements'),
1285 'css_class' => 'axiAdminIcon-center-center'
1286 ),
1287 'right center' => array(
1288 'label' => __('Right center', 'auxin-elements'),
1289 'css_class' => 'axiAdminIcon-center-right'
1290 ),
1291
1292 'left bottom' => array(
1293 'label' => __('Left bottom', 'auxin-elements'),
1294 'css_class' => 'axiAdminIcon-bottom-left'
1295 ),
1296 'center bottom' => array(
1297 'label' => __('Center bottom', 'auxin-elements'),
1298 'css_class' => 'axiAdminIcon-bottom-center'
1299 ),
1300 'right bottom' => array(
1301 'label' => __('Right bottom', 'auxin-elements'),
1302 'css_class' => 'axiAdminIcon-bottom-right'
1303 )
1304 ),
1305 'type' => 'radio-image',
1306 'dependency' => array(
1307 array(
1308 'id' => 'auxin_login_bg_show',
1309 'value' => array( '1' )
1310 )
1311 ),
1312 'transport' => 'refresh',
1313 'default' => 'left top'
1314 );
1315
1316 $fields_sections_list['fields'][] = array(
1317 'title' => __('Background Attachment', 'auxin-elements'),
1318 'description' => __('Specifies whether the background is fixed or scrollable as user scrolls the page.', 'auxin-elements'),
1319 'id' => 'auxin_login_bg_attach',
1320 'section' => 'tools-section-login',
1321 'type' => 'radio-image',
1322 'choices' => array(
1323 'scroll' => array(
1324 'label' => __('Scroll', 'auxin-elements'),
1325 'css_class' => 'axiAdminIcon-bg-attachment-scroll',
1326 ),
1327 'fixed' => array(
1328 'label' => __('Fixed', 'auxin-elements'),
1329 'css_class' => 'axiAdminIcon-bg-attachment-fixed',
1330 )
1331 ),
1332 'dependency' => array(
1333 array(
1334 'id' => 'auxin_login_bg_show',
1335 'value' => array( '1' )
1336 )
1337 ),
1338 'transport' => 'refresh',
1339 'default' => 'scroll'
1340 );
1341
1342 //--------------------------------
1343
1344 $fields_sections_list['fields'][] = array(
1345 'title' => __('Custom CSS class name', 'auxin-elements'),
1346 'description' => __('In this field you can define custom CSS class name for login page.
1347 This class name will be added to body classes in login page and is useful for advance custom styling purposes.', 'auxin-elements'),
1348 'id' => 'auxin_login_body_class',
1349 'section' => 'tools-section-login',
1350 'dependency' => array(),
1351 'transport' => 'refresh',
1352 'default' => '',
1353 'type' => 'text'
1354 );
1355
1356 $fields_sections_list['fields'][] = array(
1357 'title' => __('Login Style', 'auxin-elements'),
1358 'description' => __('Custom Css style for login page', 'auxin-elements'),
1359 'id' => 'auxin_login_style',
1360 'section' => 'tools-section-login',
1361 'dependency' => array(),
1362 'transport' => 'refresh',
1363 'type' => 'code',
1364 'default' => '',
1365 'mode' => 'css'
1366 );
1367
1368 // Sub section - 404 page customizer -------------------------------
1369
1370 $fields_sections_list['sections'][] = array(
1371 'id' => 'tools-section-404',
1372 'parent' => 'tools-section', // section parent's id
1373 'title' => __( '404 Page', 'auxin-elements' ),
1374 'description' => __( '404 Page Options', 'auxin-elements' )
1375 //'description' => __( 'Preview 404 page', 'auxin-elements' ),
1376 );
1377
1378 $fields_sections_list['fields'][] = array(
1379 'title' => __('404 Page', 'auxin-elements'),
1380 'description' => __('Specifies a page to display on 404.', 'auxin-elements'),
1381 'id' => 'auxin_404_page',
1382 'section' => 'tools-section-404',
1383 'dependency' => array(),
1384 'transport' => 'refresh',
1385 'default' => 'default',
1386 'type' => 'select',
1387 'choices' => auxin_get_all_pages(),
1388 );
1389
1390 // Sub section - Maintenance page customizer -------------------------------
1391
1392 $fields_sections_list['sections'][] = array(
1393 'id' => 'tools-section-maintenance',
1394 'parent' => 'tools-section', // section parent's id
1395 'title' => __( 'Maintenance or Comingsoon Page', 'auxin-elements' ),
1396 'description' => __( 'Maintenance or Comingsoon Page Options', 'auxin-elements' )
1397 //'description' => __( 'Preview maintenance page', 'auxin-elements' ),
1398 );
1399
1400 $fields_sections_list['fields'][] = array(
1401 'title' => __( 'Enable Maintenance or Comingsoon Mode', 'auxin-elements' ),
1402 'description' => __( 'With this option you can manually enable Maintenance or Comingsoon mode', 'auxin-elements' ),
1403 'id' => 'auxin_maintenance_enable',
1404 'section' => 'tools-section-maintenance',
1405 'dependency' => array(),
1406 'transport' => 'refresh',
1407 'default' => '0',
1408 'type' => 'switch',
1409 );
1410
1411 $fields_sections_list['fields'][] = array(
1412 'title' => __('Maintenance or Comingsoon Page', 'auxin-elements'),
1413 'description' => __('In This Case You Can Set Your Specifc Page for Maintenance or Comingsoon Mode', 'auxin-elements'),
1414 'id' => 'auxin_maintenance_page',
1415 'section' => 'tools-section-maintenance',
1416 'dependency' => array(
1417 array(
1418 'id' => 'auxin_maintenance_enable',
1419 'value' => array( '1' )
1420 )
1421 ), 'transport' => 'refresh',
1422 'default' => 'default',
1423 'type' => 'select',
1424 'choices' => auxin_get_all_pages(),
1425 );
1426
1427 // Sub section - Custom Search -------------------------------
1428
1429 $fields_sections_list['sections'][] = array(
1430 'id' => 'tools-section-search-result',
1431 'parent' => 'tools-section', // section parent's id
1432 'title' => __( 'Search Results', 'auxin-elements' ),
1433 'description' => __( 'Search Results Options', 'auxin-elements' )
1434 );
1435
1436 //--------------------------------
1437
1438 $fields_sections_list['fields'][] = array(
1439 'title' => __( 'Exclude Posts Types', 'auxin-elements' ),
1440 'description' => __( 'The post types which should be excluded from search results.', 'auxin-elements' ),
1441 'id' => 'auxin_search_exclude_post_types',
1442 'section' => 'tools-section-search-result',
1443 'dependency' => array(),
1444 'transport' => 'postMessage',
1445 'default' => '',
1446 'type' => 'select2-post-types',
1447 );
1448
1449 $fields_sections_list['fields'][] = array(
1450 'title' => __( 'Exclude Posts Without Featured Image', 'auxin-elements' ),
1451 'description' => __( 'Exclude posts without featured image in search results.', 'auxin-elements' ),
1452 'id' => 'auxin_search_exclude_no_media',
1453 'section' => 'tools-section-search-result',
1454 'dependency' => array(),
1455 'transport' => 'postMessage',
1456 'default' => '',
1457 'type' => 'switch',
1458 );
1459
1460 $fields_sections_list['fields'][] = array(
1461 'title' => __( 'Include posts', 'auxin-elements' ),
1462 'description' => __( 'If you intend to include additional posts, you should specify the posts here.<br>You have to insert the Post IDs that are separated by camma (eg. 53,34,87,25)', 'auxin-elements' ),
1463 'id' => 'auxin_search_pinned_contents',
1464 'section' => 'tools-section-search-result',
1465 'dependency' => array(),
1466 'transport' => 'postMessage',
1467 'default' => '',
1468 'type' => 'text',
1469 );
1470
1471 // Sub section - Custom Search -------------------------------
1472
1473 $fields_sections_list['sections'][] = array(
1474 'id' => 'tools-section-import-export',
1475 'parent' => 'tools-section', // section parent's id
1476 'title' => __( 'Import/Export', 'auxin-elements' ),
1477 'description' => __( 'Import or Export options', 'auxin-elements' )
1478 );
1479
1480
1481 //--------------------------------
1482
1483 $fields_sections_list['fields'][] = array(
1484 'title' => __( 'Export Data', 'auxin-elements' ),
1485 'description' => __( 'Your theme options code which you can import later.', 'auxin-elements' ),
1486 'id' => 'auxin_customizer_export',
1487 'section' => 'tools-section-import-export',
1488 'dependency' => array(),
1489 'transport' => 'postMessage',
1490 'default' => '',
1491 'type' => 'export',
1492 );
1493
1494 $fields_sections_list['fields'][] = array(
1495 'title' => __( 'Import Data', 'auxin-elements' ),
1496 'description' => __( 'Paste the exported theme options code to import into theme.', 'auxin-elements' ),
1497 'id' => 'auxin_customizer_import',
1498 'section' => 'tools-section-import-export',
1499 'dependency' => array(),
1500 'transport' => 'postMessage',
1501 'default' => '',
1502 'type' => 'import',
1503 );
1504
1505 if( defined( 'AUX_WHITELABEL_DISPLAY' ) && AUX_WHITELABEL_DISPLAY ){
1506 // White Label section ==================================================================
1507
1508 $fields_sections_list['sections'][] = array(
1509 'id' => 'whitelabel-section',
1510 'parent' => '', // section parent's id
1511 'title' => __( 'White Label', 'auxin-elements'),
1512 'description' => __( 'White Label Settings', 'auxin-elements'),
1513 'icon' => 'axicon-doc'
1514 );
1515
1516 // Sub section - Custom Labels -------------------------------
1517
1518 $fields_sections_list['sections'][] = array(
1519 'id' => 'whitelabel-section-labels',
1520 'parent' => 'whitelabel-section', // section parent's id
1521 'title' => __( 'Settings', 'auxin-elements'),
1522 'description' => __( 'Change PHLOX labels.', 'auxin-elements')
1523 );
1524
1525 $fields_sections_list['fields'][] = array(
1526 'title' => __( 'Theme Name', 'auxin-elements' ),
1527 'description' => '',
1528 'id' => 'auxin_whitelabel_theme_name',
1529 'section' => 'whitelabel-section-labels',
1530 'dependency' => array(),
1531 'transport' => 'postMessage',
1532 'default' => THEME_NAME_I18N,
1533 'type' => 'text',
1534 );
1535
1536 $fields_sections_list['fields'][] = array(
1537 'title' => __('Theme Author Name', 'auxin-elements'),
1538 'id' => 'auxin_whitelabel_theme_author_name',
1539 'section' => 'whitelabel-section-labels',
1540 'type' => 'text',
1541 'transport' => 'postMessage',
1542 'default' => ''
1543 );
1544
1545 $fields_sections_list['fields'][] = array(
1546 'title' => __('Theme Author URL', 'auxin-elements'),
1547 'id' => 'auxin_whitelabel_theme_author_url',
1548 'section' => 'whitelabel-section-labels',
1549 'type' => 'url',
1550 'transport' => 'postMessage',
1551 'default' => ''
1552 );
1553
1554 $fields_sections_list['fields'][] = array(
1555 'title' => __('Theme Description', 'auxin-elements'),
1556 'id' => 'auxin_whitelabel_theme_description',
1557 'section' => 'whitelabel-section-labels',
1558 'type' => 'textarea',
1559 'transport' => 'postMessage',
1560 'default' => ''
1561 );
1562
1563 $fields_sections_list['fields'][] = array(
1564 'title' => __('Theme Screenshot (1200x900)', 'auxin-elements'),
1565 'id' => 'auxin_whitelabel_theme_screenshot',
1566 'section' => 'whitelabel-section-labels',
1567 'type' => 'image',
1568 'transport' => 'postMessage',
1569 'default' => ''
1570 );
1571
1572 // Sub section - Custom Labels -------------------------------
1573
1574 $fields_sections_list['sections'][] = array(
1575 'id' => 'whitelabel-section-views',
1576 'parent' => 'whitelabel-section', // section parent's id
1577 'title' => __( 'Displays', 'auxin-elements'),
1578 'description' => __( 'Change PHLOX admin views.', 'auxin-elements')
1579 );
1580
1581 $fields_sections_list['fields'][] = array(
1582 'title' => __( 'Hide Notifications', 'auxin-elements' ),
1583 'description' => '',
1584 'id' => 'auxin_whitelabel_hide_notices',
1585 'section' => 'whitelabel-section-views',
1586 'dependency' => array(),
1587 'transport' => 'postMessage',
1588 'default' => '0',
1589 'type' => 'switch',
1590 );
1591
1592 $fields_sections_list['fields'][] = array(
1593 'title' => __( 'Hide Theme Badge', 'auxin-elements' ),
1594 'description' => '',
1595 'id' => 'auxin_whitelabel_hide_theme_badge',
1596 'section' => 'whitelabel-section-views',
1597 'dependency' => array(),
1598 'transport' => 'postMessage',
1599 'default' => '0',
1600 'type' => 'switch',
1601 );
1602
1603 $fields_sections_list['fields'][] = array(
1604 'title' => __( 'Hide Phlox Menu', 'auxin-elements' ),
1605 'description' => '',
1606 'id' => 'auxin_whitelabel_hide_menu',
1607 'section' => 'whitelabel-section-views',
1608 'dependency' => array(),
1609 'transport' => 'postMessage',
1610 'default' => '0',
1611 'type' => 'switch',
1612 );
1613
1614 $fields_sections_list['fields'][] = array(
1615 'title' => __( 'Hide Dashboard Section', 'auxin-elements' ),
1616 'description' => '',
1617 'id' => 'auxin_whitelabel_hide_dashboard_section',
1618 'section' => 'whitelabel-section-views',
1619 'dependency' => array(),
1620 'transport' => 'postMessage',
1621 'default' => '0',
1622 'dependency' => array(
1623 array(
1624 'id' => 'auxin_whitelabel_hide_menu',
1625 'value' => array('1'),
1626 'operator'=> '!='
1627 )
1628 ),
1629 'type' => 'switch',
1630 );
1631
1632 $fields_sections_list['fields'][] = array(
1633 'title' => __( 'Hide Customization Section', 'auxin-elements' ),
1634 'description' => '',
1635 'id' => 'auxin_whitelabel_hide_customization_section',
1636 'section' => 'whitelabel-section-views',
1637 'dependency' => array(),
1638 'transport' => 'postMessage',
1639 'default' => '0',
1640 'dependency' => array(
1641 array(
1642 'id' => 'auxin_whitelabel_hide_menu',
1643 'value' => array('1'),
1644 'operator'=> '!='
1645 )
1646 ),
1647 'type' => 'switch',
1648 );
1649
1650 $fields_sections_list['fields'][] = array(
1651 'title' => __( 'Hide Demo Importer Section', 'auxin-elements' ),
1652 'description' => '',
1653 'id' => 'auxin_whitelabel_hide_demo_importer_section',
1654 'section' => 'whitelabel-section-views',
1655 'dependency' => array(),
1656 'transport' => 'postMessage',
1657 'default' => '0',
1658 'dependency' => array(
1659 array(
1660 'id' => 'auxin_whitelabel_hide_menu',
1661 'value' => array('1'),
1662 'operator'=> '!='
1663 )
1664 ),
1665 'type' => 'switch',
1666 );
1667
1668 $fields_sections_list['fields'][] = array(
1669 'title' => __( 'Hide Template Kits Section', 'auxin-elements' ),
1670 'description' => '',
1671 'id' => 'auxin_whitelabel_hide_template_kits_section',
1672 'section' => 'whitelabel-section-views',
1673 'dependency' => array(),
1674 'transport' => 'postMessage',
1675 'default' => '0',
1676 'dependency' => array(
1677 array(
1678 'id' => 'auxin_whitelabel_hide_menu',
1679 'value' => array('1'),
1680 'operator'=> '!='
1681 )
1682 ),
1683 'type' => 'switch',
1684 );
1685
1686 $fields_sections_list['fields'][] = array(
1687 'title' => __( 'Hide Plugins Section', 'auxin-elements' ),
1688 'description' => '',
1689 'id' => 'auxin_whitelabel_hide_plugins_section',
1690 'section' => 'whitelabel-section-views',
1691 'dependency' => array(),
1692 'transport' => 'postMessage',
1693 'default' => '0',
1694 'dependency' => array(
1695 array(
1696 'id' => 'auxin_whitelabel_hide_menu',
1697 'value' => array('1'),
1698 'operator'=> '!='
1699 )
1700 ),
1701 'type' => 'switch',
1702 );
1703
1704 $fields_sections_list['fields'][] = array(
1705 'title' => __( 'Hide Tutorials Section', 'auxin-elements' ),
1706 'description' => '',
1707 'id' => 'auxin_whitelabel_hide_tutorials_section',
1708 'section' => 'whitelabel-section-views',
1709 'dependency' => array(),
1710 'transport' => 'postMessage',
1711 'default' => '0',
1712 'dependency' => array(
1713 array(
1714 'id' => 'auxin_whitelabel_hide_menu',
1715 'value' => array('1'),
1716 'operator'=> '!='
1717 )
1718 ),
1719 'type' => 'switch',
1720 );
1721
1722 $fields_sections_list['fields'][] = array(
1723 'title' => __( 'Hide Feedback Section', 'auxin-elements' ),
1724 'description' => '',
1725 'id' => 'auxin_whitelabel_hide_feedback_section',
1726 'section' => 'whitelabel-section-views',
1727 'dependency' => array(),
1728 'transport' => 'postMessage',
1729 'default' => '0',
1730 'dependency' => array(
1731 array(
1732 'id' => 'auxin_whitelabel_hide_menu',
1733 'value' => array('1'),
1734 'operator'=> '!='
1735 )
1736 ),
1737 'type' => 'switch',
1738 );
1739 }
1740
1741 return $fields_sections_list;
1742 }
1743
1744 add_filter( 'auxin_defined_option_fields_sections', 'auxin_add_theme_options_in_plugin', 12, 1 );
1745
1746
1747
1748
1749
1750 /*-----------------------------------------------------------------------------------*/
1751 /* Injects JavaScript codes from theme options in head
1752 /*-----------------------------------------------------------------------------------*/
1753
1754 function auxin_ele_add_js_to_head() {
1755 if( $inline_js = auxin_get_option( 'auxin_user_custom_js_head' ) ){
1756 echo '<script>'. $inline_js .'</script>';
1757 }
1758 if( isset( $_GET['helper'] ) ){
1759 echo '<style>.elementor-section.elementor-section-boxed>.elementor-container{box-shadow:0 0 0 1px #2b83eb;}</style>';
1760 }
1761 }
1762 add_action( 'wp_head','auxin_ele_add_js_to_head' );
1763
1764
1765 function auxin_ele_add_google_analytics_code() {
1766 if( $google_analytics_code = auxin_get_option( 'auxin_user_google_analytics' ) ){
1767 ?>
1768 <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_attr( $google_analytics_code ); ?>"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '<?php echo esc_attr( $google_analytics_code ); ?>');</script>
1769 <?php
1770 }
1771 }
1772 add_action( 'wp_head','auxin_ele_add_google_analytics_code' );
1773
1774 /*-----------------------------------------------------------------------------------*/
1775 /* Injects JavaScript codes from theme options in JS file
1776 /*-----------------------------------------------------------------------------------*/
1777
1778 function auxin_ele_add_theme_options_to_js_file( $js ){
1779 $js['theme_options_custom'] = auxin_get_option( 'auxin_user_custom_js' );
1780
1781 $js['theme_options_google_marketing'] = auxin_get_option( 'auxin_user_google_marketing' );
1782
1783 // @deprecated in version 2.5.0
1784 unset( $js['theme_options_google_analytics'] );
1785
1786 return $js;
1787 }
1788 add_filter( 'auxin_custom_js_file_content', 'auxin_ele_add_theme_options_to_js_file' );
1789
1790
1791 /*-----------------------------------------------------------------------------------*/
1792 /* Adds the custom CSS class of the login page to body element
1793 /*-----------------------------------------------------------------------------------*/
1794
1795 function auxin_login_body_class( $classes ){
1796
1797 if( $custom_class = auxin_get_option('auxin_login_body_class' ) ){
1798 $classes['auxin_custom'] = $custom_class;
1799 }
1800
1801 if( $custom_skin = auxin_get_option('auxin_login_skin' ) ){
1802 $classes['auxin_skin'] = esc_attr( 'auxin-login-skin-' . $custom_skin );
1803 }
1804
1805 return $classes;
1806 }
1807 add_action( 'auxin_functions_ready', function(){
1808 add_filter( 'login_body_class', 'auxin_login_body_class' );
1809 });
1810
1811
1812
1813 /*-----------------------------------------------------------------------------------*/
1814 /* Adds proper styles for background and logo on login page
1815 /*-----------------------------------------------------------------------------------*/
1816
1817 function auxin_login_head(){
1818
1819 $styles = '';
1820
1821 if( $bg_image_id = auxin_get_option( 'auxin_login_logo_image' ) ){
1822 $bg_image = wp_get_attachment_url( $bg_image_id );
1823 $styles .= "background-image: url( $bg_image ); ";
1824
1825 $bg_width = auxin_get_option( 'auxin_login_logo_width' , '84' );
1826 $bg_height = auxin_get_option( 'auxin_login_logo_height', '84' );
1827
1828 $bg_width = rtrim( $bg_width , 'px' ) . 'px';
1829 $bg_height = rtrim( $bg_height, 'px' ) . 'px';
1830
1831 $styles .= "background-size: $bg_width $bg_height; ";
1832 $styles .= "width: $bg_width; height: $bg_height; ";
1833
1834 echo "<style>#login h1 a { " . wp_kses_post( $styles ) . " }</style>";
1835 }
1836
1837 if( auxin_get_option( 'auxin_login_bg_show' ) ){
1838
1839 // get styles for background image
1840 $bg_styles = auxin_generate_styles_for_backgroud_fields( 'auxin_login_bg', 'option', array(
1841 'color' => 'auxin_login_bg_color',
1842 'image' => 'auxin_login_bg_image',
1843 'repeat' => 'auxin_login_bg_repeat',
1844 'size' => 'auxin_login_bg_size',
1845 'position' => 'auxin_login_bg_position',
1846 'attachment' => 'auxin_login_bg_attachment',
1847 'clip' => 'auxin_login_bg_clip'
1848 ) );
1849
1850 $pattern_style = auxin_generate_styles_for_backgroud_fields( 'auxin_login_bg', 'option', array(
1851 'pattern' => 'auxin_login_bg_pattern'
1852 ) );
1853
1854 echo "<style>body.login { " . wp_kses_post( $bg_styles ) . " } body.login:before { " . wp_kses_post( $pattern_style ) . " }</style>";
1855 }
1856
1857 }
1858 add_action( 'auxin_functions_ready', function(){
1859 add_action( 'login_head', 'auxin_login_head' );
1860 });
1861
1862
1863 /*-----------------------------------------------------------------------------------*/
1864 /* Changes the login header url to home url
1865 /*-----------------------------------------------------------------------------------*/
1866
1867 function auxin_login_headerurl( $login_header_url ){
1868
1869 if ( ! is_multisite() ) {
1870 $login_header_url = home_url();
1871 }
1872 return $login_header_url;
1873 }
1874 add_action( 'auxin_functions_ready', function(){
1875 add_filter( 'login_headerurl', 'auxin_login_headerurl' );
1876 });
1877
1878 /*-----------------------------------------------------------------------------------*/
1879 /* Changes the login header url to home url
1880 /*-----------------------------------------------------------------------------------*/
1881
1882 function auxin_login_headertext( $login_header_title ){
1883
1884 if ( ! is_multisite() ) {
1885 $login_header_title = get_bloginfo( 'name' );
1886 }
1887 return $login_header_title;
1888 }
1889 add_action( 'auxin_functions_ready', function(){
1890 add_filter( 'login_headertext', 'auxin_login_headertext' );
1891 });
1892
1893 /*-----------------------------------------------------------------------------------*/
1894 /* Adds custom message above the login form
1895 /*-----------------------------------------------------------------------------------*/
1896
1897 function auxin_login_message( $login_message ){
1898
1899 if( $custom_message = auxin_get_option( 'auxin_login_message' ) ){
1900
1901 $message_wrapper_start = '<div class="message">';
1902 $message_wrapper_end = "</div>\n";
1903
1904 $custom_message_markup = $message_wrapper_start . $custom_message . $message_wrapper_end;
1905
1906 /**
1907 * Filter instructional messages displayed above the login form.
1908 *
1909 * @param string $custom_message Login message.
1910 */
1911 $login_message .= apply_filters( 'auxin_login_message', $custom_message_markup, $custom_message, $message_wrapper_start, $message_wrapper_end );
1912 }
1913
1914 return $login_message;
1915 }
1916 add_action( 'auxin_functions_ready', function(){
1917 add_filter( 'login_message', 'auxin_login_message' );
1918 });
1919
1920
1921 /*-----------------------------------------------------------------------------------*/
1922 /* Prints the custom js codes of a single page to the source page
1923 /*-----------------------------------------------------------------------------------*/
1924
1925 function auxin_custom_js_for_pages( $js, $post ){
1926 // The custom JS code for specific page
1927 if( $post && ! is_404() && is_singular() ) {
1928 $js .= get_post_meta( $post->ID, 'aux_page_custom_js', true );
1929 }
1930 return $js;
1931 }
1932 add_filter( 'auxin_footer_inline_script', 'auxin_custom_js_for_pages', 15, 2 );
1933
1934
1935 /*-----------------------------------------------------------------------------------*/
1936 /* Add preconnect for Google Fonts.
1937 /*-----------------------------------------------------------------------------------*/
1938
1939 /**
1940 * Add preconnect for Google Fonts.
1941 *
1942 * @param array $urls URLs to print for resource hints.
1943 * @param string $relation_type The relation type the URLs are printed.
1944 * @return array $urls URLs to print for resource hints.
1945 */
1946 function auxin_resource_hints( $urls, $relation_type ) {
1947 if ( wp_style_is( 'auxin-fonts-google', 'queue' ) && 'preconnect' === $relation_type ) {
1948 $urls[] = array(
1949 'href' => 'https://fonts.gstatic.com',
1950 'crossorigin',
1951 );
1952 }
1953 return $urls;
1954 }
1955 //add_filter( 'wp_resource_hints', 'auxin_resource_hints', 10, 2 );
1956
1957
1958 /*-----------------------------------------------------------------------------------*/
1959 /* Setup Header
1960 /*-----------------------------------------------------------------------------------*/
1961
1962 function auxin_after_setup_theme_extra(){
1963 // gererate shortcodes in widget text
1964 add_filter('widget_text', 'do_shortcode');
1965 // Remove wp ulike auto disaply filter
1966 remove_filter( 'the_content', 'wp_ulike_put_posts', 15 );
1967 }
1968 add_action( 'after_setup_theme', 'auxin_after_setup_theme_extra' );
1969
1970 /*-----------------------------------------------------------------------------------*/
1971 /* add excerpts to pages
1972 /*-----------------------------------------------------------------------------------*/
1973
1974 function auxin_add_excerpts_to_pages() {
1975 add_post_type_support( 'page', 'excerpt' );
1976 }
1977 add_action( 'init', 'auxin_add_excerpts_to_pages' );
1978
1979
1980 /*-----------------------------------------------------------------------------------*/
1981 /* Add some user contact fields
1982 /*-----------------------------------------------------------------------------------*/
1983
1984 function auxin_user_contactmethods($user_contactmethods){
1985 $user_contactmethods['twitter'] = __('Twitter' , 'auxin-elements');
1986 $user_contactmethods['facebook'] = __('Facebook' , 'auxin-elements');
1987 $user_contactmethods['googleplus'] = __('Google Plus', 'auxin-elements');
1988 $user_contactmethods['flickr'] = __('Flickr' , 'auxin-elements');
1989 $user_contactmethods['delicious'] = __('Delicious' , 'auxin-elements');
1990 $user_contactmethods['pinterest'] = __('Pinterest' , 'auxin-elements');
1991 $user_contactmethods['github'] = __('GitHub' , 'auxin-elements');
1992 $user_contactmethods['skills'] = __('Skills' , 'auxin-elements');
1993
1994 return $user_contactmethods;
1995 }
1996 add_filter('user_contactmethods', 'auxin_user_contactmethods');
1997
1998
1999 /*-----------------------------------------------------------------------------------*/
2000 /* Add home page menu arg to menu item list
2001 /*-----------------------------------------------------------------------------------*/
2002
2003 function auxin_add_home_page_to_menu_args( $args ) {
2004 $args['show_home'] = true;
2005 return $args;
2006 }
2007 add_filter( 'wp_page_menu_args', 'auxin_add_home_page_to_menu_args' );
2008
2009 /*-----------------------------------------------------------------------------------*/
2010 /* Print meta tags to preview post while sharing on facebook
2011 /*-----------------------------------------------------------------------------------*/
2012
2013 if( ! defined('WPSEO_VERSION') && ! class_exists('All_in_One_SEO_Pack') ){
2014
2015 function auxin_facebook_header_meta (){
2016
2017 if( ! defined('AUXIN_VERSION') ){
2018 return;
2019 }
2020
2021 // return if built-in seo is disabled or "SEO by yoast" is active
2022 if( ! auxin_get_option( 'enable_theme_seo', 1 ) ) return;
2023
2024 global $post;
2025 if( ! isset( $post ) || ! is_singular() || is_search() || is_404() ) return;
2026 setup_postdata( $post );
2027
2028 $featured_image = auxin_get_the_post_thumbnail_src( $post->ID, 90, 90, true, 90 );
2029 $post_excerpt = get_the_excerpt();
2030 ?>
2031 <meta name="title" content="<?php echo esc_attr( $post->post_title ); ?>" />
2032 <meta name="description" content="<?php echo esc_attr( $post_excerpt ); ?>" />
2033 <?php if( $featured_image) { ?>
2034 <link rel="image_src" href="<?php echo esc_url( $featured_image ); ?>" />
2035 <?php }
2036
2037 }
2038
2039 add_action( 'wp_head', 'auxin_facebook_header_meta' );
2040 }
2041
2042
2043 /**
2044 * Replace WooCommerce Default Pagination with auxin pagination
2045 *
2046 */
2047 remove_action( 'woocommerce_pagination' , 'woocommerce_pagination', 10 );
2048 add_action ( 'woocommerce_pagination', 'auxin_woocommerce_pagination' , 10 );
2049
2050 function auxin_woocommerce_pagination() {
2051 auxin_the_paginate_nav(
2052 array( 'css_class' => auxin_get_option('archive_pagination_skin') )
2053 );
2054 }
2055
2056 /*-----------------------------------------------------------------------------------*/
2057 /* the function runs when auxin framework loaded
2058 /*-----------------------------------------------------------------------------------*/
2059
2060 function auxin_on_auxin_fw_admin_loaded(){
2061
2062 // assign theme custom capabilities to roles on first run
2063 if( ! auxin_get_theme_mod( 'are_auxin_caps_assigned', 0 ) ){
2064 add_action( 'admin_init' , 'auxin_assign_default_caps_for_post_types' );
2065 set_theme_mod( 'are_auxin_caps_assigned', 1 );
2066 }
2067
2068 if ( ! auxin_get_theme_mod( 'initial_date', 0 ) ) {
2069 set_theme_mod( 'initial_date', current_time( 'mysql' ) );
2070 }
2071
2072 $slug = THEME_PRO ? 'pro' : 'free';
2073 if ( ! auxin_get_theme_mod( 'initial_version_' . $slug, 0 ) ) {
2074 set_theme_mod( 'initial_version_' . $slug, THEME_VERSION );
2075 }
2076
2077 if ( ! auxin_get_theme_mod( 'initial_date_' . $slug, 0 ) ) {
2078 set_theme_mod( 'initial_date_' . $slug, current_time( 'mysql' ) );
2079 }
2080
2081 if ( ! auxin_get_theme_mod( 'client_key', 0 ) ) {
2082 $client_key = base64_encode( get_site_url() ) . rand( 100000, 1000000 );
2083 set_theme_mod( 'client_key', str_shuffle( $client_key ) );
2084 }
2085 }
2086
2087 add_action( 'auxin_admin_loaded', 'auxin_on_auxin_fw_admin_loaded' );
2088
2089
2090 /**
2091 * Retrieves the passed time from first installation date of theme
2092 *
2093 * @return DataTimeInterface
2094 */
2095 function auxin_get_passed_installed_time(){
2096 $slug = THEME_PRO ? 'pro' : 'free';
2097 $initial_time = auxin_get_theme_mod( 'initial_date_' . $slug, "now" );
2098 $initial_date = new DateTime( $initial_time );
2099 $passed_time = $initial_date->diff( new DateTime() );
2100
2101 return $passed_time;
2102 }
2103
2104
2105 /*-------------------------------------------------------------------------------*/
2106 /* assigns theme custom post types capabilities to main roles
2107 /*-------------------------------------------------------------------------------*/
2108
2109 function auxin_assign_default_caps_for_post_types() {
2110 $auxin_registered_post_types = auxin_registered_post_types(true);
2111
2112 // the roles to add capabilities of custom post types to
2113 $roles = array('administrator', 'editor');
2114
2115 foreach ( $roles as $role_name ) {
2116
2117 $role = get_role( $role_name );
2118
2119 // loop through custom post types and add custom capabilities to defined rules
2120 foreach ( $auxin_registered_post_types as $post_type ) {
2121
2122 $post_type_object = get_post_type_object( $post_type );
2123 // add post type capabilities to role
2124 foreach ( $post_type_object->cap as $cap_key => $cap ) {
2125 if( ! in_array( $cap_key, array( 'edit_post', 'delete_post', 'read_post' ) ) )
2126 $role->add_cap( $cap );
2127 }
2128 }
2129
2130 }
2131 }
2132
2133
2134
2135
2136
2137 function auxels_add_post_type_metafields(){
2138
2139 $all_post_types = auxin_get_possible_post_types(true);
2140
2141 $auxin_is_admin = is_admin();
2142
2143 foreach ( $all_post_types as $post_type => $is_post_type_allowed ) {
2144
2145 if( ! $is_post_type_allowed ){
2146 continue;
2147 }
2148
2149 // define metabox args
2150 $metabox_args = array( 'post_type' => $post_type );
2151
2152 switch( $post_type ) {
2153
2154 case 'page':
2155
2156 $metabox_args['hub_id'] = 'axi_meta_hub_page';
2157 $metabox_args['hub_title'] = __('Page Options', 'auxin-elements');
2158 $metabox_args['to_post_types'] = array( $post_type );
2159
2160 break;
2161
2162 case 'post':
2163
2164 $metabox_args['hub_id'] = 'axi_meta_hub_post';
2165 $metabox_args['hub_title'] = __('Post Options', 'auxin-elements');
2166 $metabox_args['to_post_types'] = array( $post_type );
2167
2168 default:
2169 break;
2170 }
2171
2172 // Load metabox fields on admin
2173 if( $auxin_is_admin ){
2174 auxin_maybe_render_metabox_hub_for_post_type( $metabox_args );
2175 }
2176
2177 }
2178
2179 }
2180
2181 //add_action( 'init', 'auxels_add_post_type_metafields' );
2182
2183 /*-----------------------------------------------------------------------------------*/
2184 /* Add custom blog page tamplate
2185 /*-----------------------------------------------------------------------------------*/
2186
2187 /**
2188 * Add custom page templates
2189 *
2190 * @param string $result The current custom blog page template markup
2191 * @param string $page_template The name of page template
2192 *
2193 * @return string The markup for current page template
2194 */
2195 function auxels_blog_page_templates( $result, $page_template ){
2196
2197 // page number
2198 $paged = max( 1, get_query_var('paged'), get_query_var('page') );
2199
2200 // posts perpage
2201 $per_page = get_option( 'posts_per_page' );
2202
2203 // if template type is masonry
2204 if( strpos( $page_template, 'blog-type-6' ) ){
2205
2206 $args = array(
2207 'title' => '',
2208 'num' => $per_page,
2209 'paged' => $paged,
2210 'order_by' => 'menu_order date',
2211 'order' => 'desc',
2212 'show_media' => true,
2213 'exclude_without_media' => 0,
2214 'exclude_custom_post_formats' => 0,
2215 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 0 ) ),
2216 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ),
2217 'show_title' => true,
2218 'show_info' => true,
2219 'show_readmore' => true,
2220 'show_author_footer' => false,
2221 'tag' => '',
2222 'reset_query' => true
2223 );
2224
2225 // get the shortcode base blog page
2226 $result = auxin_widget_recent_posts_masonry_callback( $args );
2227 }
2228
2229 // if template type is tiles
2230 elseif( strpos( $page_template, 'blog-type-9' ) ){
2231
2232 $args = array(
2233 'title' => '',
2234 'num' => $per_page,
2235 'paged' => $paged,
2236 'order_by' => 'menu_order date',
2237 'order' => 'desc',
2238 'show_media' => true,
2239 'exclude_without_media' => 0,
2240 'exclude_custom_post_formats' => 0,
2241 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 0 ) ),
2242 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ),
2243 'show_title' => true,
2244 'show_info' => true,
2245 'show_readmore' => true,
2246 'show_author_footer' => false,
2247 'tag' => '',
2248 'reset_query' => true
2249 );
2250
2251 // get the shortcode base blog page
2252 $result = auxin_widget_recent_posts_tiles_callback( $args );
2253 }
2254
2255 // if template type is land
2256 elseif( strpos( $page_template, 'blog-type-8' ) ){
2257
2258 $args = array(
2259 'title' => '',
2260 'num' => $per_page,
2261 'paged' => $paged,
2262 'order_by' => 'menu_order date',
2263 'order' => 'desc',
2264 'show_media' => true,
2265 'exclude_without_media' => 0,
2266 'exclude_custom_post_formats' => 0,
2267 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 0 ) ),
2268 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ),
2269 'show_excerpt' => true,
2270 'excerpt_len' => '160',
2271 'show_title' => true,
2272 'show_info' => true,
2273 'show_readmore' => true,
2274 'show_author_footer' => false,
2275 'tag' => '',
2276 'reset_query' => true
2277 );
2278
2279 // get the shortcode base blog page
2280 $result = auxin_widget_recent_posts_land_style_callback( $args );
2281 }
2282
2283 // if template type is timeline
2284 elseif( strpos( $page_template, 'blog-type-7' ) ){
2285
2286 $args = array(
2287 'title' => '',
2288 'num' => $per_page,
2289 'paged' => $paged,
2290 'order_by' => 'menu_order date',
2291 'order' => 'desc',
2292 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ),
2293 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ),
2294 'show_media' => true,
2295 'show_excerpt' => true,
2296 'excerpt_len' => '160',
2297 'show_title' => true,
2298 'show_info' => true,
2299 'show_readmore' => true,
2300 'show_author_footer' => false,
2301 'timeline_alignment' => 'center',
2302 'tag' => '',
2303 'reset_query' => true
2304 );
2305
2306 // get the shortcode base blog page
2307 $result = auxin_widget_recent_posts_timeline_callback( $args );
2308 }
2309
2310 // if template type is grid
2311 elseif( strpos( $page_template, 'blog-type-5' ) ){
2312
2313 $args = array(
2314 'title' => '',
2315 'num' => $per_page,
2316 'order_by' => 'menu_order date',
2317 'order' => 'desc',
2318 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ),
2319 'paged' => $paged,
2320 'show_media' => true,
2321 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ),
2322 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ),
2323 'show_excerpt' => true,
2324 'excerpt_len' => '160',
2325 'show_title' => true,
2326 'show_info' => true,
2327 'show_readmore' => true,
2328 'show_author_footer' => false,
2329 'desktop_cnum' => esc_attr( auxin_get_option( 'post_index_column_number', 4 ) ),
2330 'tablet_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_tablet', 2 ) ),
2331 'phone_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_mobile', 1 ) ),
2332 'preview_mode' => 'grid',
2333 'tag' => '',
2334 'reset_query' => true
2335 );
2336
2337 // get the shortcode base blog page
2338 $result = auxin_widget_recent_posts_callback( $args );
2339 }
2340
2341 return $result;
2342 }
2343
2344 add_filter( 'auxin_blog_page_template_archive_content', 'auxels_blog_page_templates', 10, 2 );
2345
2346
2347 /*-----------------------------------------------------------------------------------*/
2348 /* Add custom blog archive tamplate types
2349 /*-----------------------------------------------------------------------------------*/
2350
2351 /**
2352 * Add custom page templates
2353 *
2354 * @param string $result The current custom blog loop template markup
2355 * @param string $page_template The ID of template type option
2356 *
2357 * @return string The markup for current blog archive page
2358 */
2359 function auxels_add_blog_archive_custom_template_layouts( $result, $template_type_id ){
2360
2361 // get template type id
2362 $post_loadmore_type = auxin_get_option( 'post_index_loadmore_type', '' );
2363 // get the length of content
2364 $excerpt_len = esc_attr( auxin_get_option( 'blog_content_on_listing_length' ) );
2365
2366 // default value for showing info
2367 $show_post_info = $show_post_date = $show_post_author = $show_post_categories = true;
2368
2369 $author_or_readmore = 'readmore';
2370 $show_post_date = true;
2371 $show_post_categories = true;
2372 $blog_content_on_listing = 'excerpt';
2373 $display_comments = true;
2374 $display_author_header = true;
2375 $display_author_footer = false;
2376
2377 // Use taxonomy template option if is category or tag archive page
2378
2379 if( is_category() || is_tag() ){
2380 $author_or_readmore = auxin_get_option( 'display_post_taxonomy_author_readmore', 'readmore');
2381 $post_loadmore_type = auxin_get_option( 'post_taxonomy_loadmore_type', '' );
2382 $excerpt_len = auxin_get_option( 'post_taxonomy_archive_on_listing_length', '' );
2383 $show_post_info = auxin_get_option( 'display_post_taxonomy_info', true );
2384 $show_post_date = auxin_get_option( 'display_post_taxonomy_info_date', true );
2385 $show_post_categories = auxin_get_option( 'display_post_taxonomy_info_categories', true );
2386 $blog_content_on_listing = auxin_get_option( 'post_taxonomy_archive_content_on_listing', 'excerpt' );
2387 $display_comments = auxin_get_option( 'display_post_taxonomy_widget_comments', true);
2388 $display_author_header = auxin_get_option( 'display_post_taxonomy_author_header', true);
2389 $display_author_footer = auxin_get_option( 'display_post_taxonomy_author_footer', false);
2390
2391 } elseif ( auxin_is_blog() ) {
2392 $author_or_readmore = auxin_get_option( 'blog_display_author_readmore', 'readmore');
2393 $display_author_header = auxin_get_option( 'blog_display_author_header', true);
2394 $display_author_footer = auxin_get_option( 'blog_display_author_footer', false);
2395 $show_post_info = auxin_get_option( 'display_post_info', true );
2396 $show_post_date = auxin_get_option( 'display_post_info_date', true );
2397 $show_post_categories = auxin_get_option( 'display_post_info_categories', true );
2398 $blog_content_on_listing = auxin_get_option( 'blog_content_on_listing', 'excerpt' );
2399 $excerpt_len = auxin_get_option( 'blog_content_on_listing_length', '' );
2400 $display_comments = auxin_get_option( 'display_post_comments_number', true);
2401 } else {
2402 $blog_content_on_listing = 'excerpt';
2403 }
2404
2405 $show_post_author = $show_post_author ? 'author' : 'readmore';
2406 $show_excerpt = 'none' === $blog_content_on_listing ? false : true ;
2407 $excerpt_len = 'full' === $blog_content_on_listing ? null : $excerpt_len ;
2408
2409 // page number
2410 $paged = max( 1, get_query_var('paged'), get_query_var('page') );
2411 // posts perpage
2412 $per_page = get_option( 'posts_per_page' );
2413
2414 if( 6 == $template_type_id ){
2415 $args = array(
2416 'num' => $per_page,
2417 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ),
2418 'exclude_custom_post_formats' => 0,
2419 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ),
2420 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ),
2421 'display_comments' => $display_comments,
2422 'display_author_footer' => $display_author_footer,
2423 'display_author_header' => $display_author_header,
2424 'loadmore_type' => esc_attr( $post_loadmore_type ),
2425 'paged' => $paged,
2426 'show_media' => true,
2427 'show_excerpt' => $show_excerpt,
2428 'excerpt_len' => $excerpt_len,
2429 'show_info' => esc_attr( $show_post_info ),
2430 'show_date' => esc_attr( $show_post_date ),
2431 'display_categories' => esc_attr( $show_post_categories ),
2432 'author_or_readmore' => $author_or_readmore,
2433 'content_layout' => esc_attr( auxin_get_option( 'post_index_column_content_layout', 'full' ) ),
2434 'desktop_cnum' => esc_attr( auxin_get_option( 'post_index_column_number' ) ),
2435 'tablet_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_tablet' ) ),
2436 'phone_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_mobile' ) ),
2437 'tag' => '',
2438 'extra_classes' => '',
2439 'custom_el_id' => '',
2440 'reset_query' => false,
2441 'use_wp_query' => true,
2442 'request_from' => 'archive'
2443 );
2444
2445 $result = auxin_widget_recent_posts_masonry_callback( $args );
2446
2447 // if template type is tiles
2448 } elseif( 9 == $template_type_id ){
2449
2450 $args = array(
2451 'num' => $per_page,
2452 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ),
2453 'exclude_custom_post_formats' => 0,
2454 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ),
2455 'loadmore_type' => esc_attr( $post_loadmore_type ),
2456 'paged' => $paged,
2457 'show_media' => true,
2458 'show_excerpt' => $show_excerpt,
2459 'excerpt_len' => $excerpt_len,
2460 'display_title' => true,
2461 'display_comments' => $display_comments,
2462 'show_info' => esc_attr( $show_post_info ),
2463 'show_date' => esc_attr( $show_post_date ),
2464 'display_categories' => esc_attr( $show_post_categories ),
2465 'author_or_readmore' => $author_or_readmore,
2466 'display_author_footer' => $display_author_footer,
2467 'display_author_header' => $display_author_header,
2468 'tag' => '',
2469 'extra_classes' => '',
2470 'custom_el_id' => '',
2471 'reset_query' => false,
2472 'use_wp_query' => true,
2473 'request_from' => 'archive'
2474 );
2475
2476 $result = auxin_widget_recent_posts_tiles_callback( $args );
2477
2478 // if template type is land
2479 } elseif( 8 == $template_type_id ){
2480
2481 $args = array(
2482 'num' => $per_page,
2483 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ),
2484 'exclude_custom_post_formats' => 0,
2485 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ),
2486 'show_media' => true,
2487 'paged' => $paged,
2488 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ),
2489 'display_comments' => $display_comments,
2490 'loadmore_type' => esc_attr( $post_loadmore_type ),
2491 'show_excerpt' => $show_excerpt,
2492 'excerpt_len' => $excerpt_len,
2493 'display_title' => true,
2494 'show_info' => esc_attr( $show_post_info ),
2495 'show_date' => esc_attr( $show_post_date ),
2496 'display_categories' => esc_attr( $show_post_categories ),
2497 'author_or_readmore' => $author_or_readmore,
2498 'display_author_footer' => $display_author_footer,
2499 'display_author_header' => $display_author_header,
2500 'image_aspect_ratio' => esc_attr( auxin_get_option( 'post_image_aspect_ratio' ) ),
2501 'tag' => '',
2502 'extra_classes' => '',
2503 'custom_el_id' => '',
2504 'reset_query' => false,
2505 'use_wp_query' => true,
2506 'request_from' => 'archive'
2507 );
2508
2509 $result = auxin_widget_recent_posts_land_style_callback( $args );
2510
2511 // if template type is timeline
2512 } elseif( 7 == $template_type_id ){
2513
2514 $args = array(
2515 'num' => $per_page,
2516 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ),
2517 'exclude_custom_post_formats' => 0,
2518 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ),
2519 'show_media' => true,
2520 'paged' => $paged,
2521 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ),
2522 'display_comments' => $display_comments,
2523 'loadmore_type' => esc_attr( $post_loadmore_type ),
2524 'show_excerpt' => $show_excerpt,
2525 'excerpt_len' => $excerpt_len,
2526 'display_title' => true,
2527 'show_info' => esc_attr( $show_post_info ),
2528 'show_date' => esc_attr( $show_post_date ),
2529 'display_categories' => esc_attr( $show_post_categories ),
2530 'author_or_readmore' => $author_or_readmore,
2531 'display_author_footer' => $display_author_footer,
2532 'display_author_header' => $display_author_header,
2533 'image_aspect_ratio' => esc_attr( auxin_get_option( 'post_image_aspect_ratio' ) ),
2534 'timeline_alignment' => esc_attr( auxin_get_option( 'post_index_timeline_alignment', 'center' ) ),
2535 'tag' => '',
2536 'reset_query' => false,
2537 'use_wp_query' => true,
2538 'request_from' => 'archive'
2539 );
2540
2541 $result = auxin_widget_recent_posts_timeline_callback( $args );
2542
2543 // if template type is grid
2544 } elseif( 5 == $template_type_id ){
2545
2546 $args = array(
2547 'num' => $per_page,
2548 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ),
2549 'exclude_custom_post_formats' => 0,
2550 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ),
2551 'show_media' => true,
2552 'show_excerpt' => $show_excerpt,
2553 'paged' => $paged,
2554 'post_info_position' => esc_attr( auxin_get_option( 'post_info_position', 'after-title' ) ),
2555 'show_info' => esc_attr( $show_post_info ),
2556 'show_date' => esc_attr( $show_post_date ),
2557 'display_categories' => esc_attr( $show_post_categories ),
2558 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ),
2559 'display_comments' => $display_comments,
2560 'loadmore_type' => esc_attr( $post_loadmore_type ),
2561 'content_layout' => esc_attr( auxin_get_option( 'post_index_column_content_layout', 'full' ) ),
2562 'excerpt_len' => $excerpt_len,
2563 'display_title' => true,
2564 'author_or_readmore' => $author_or_readmore,
2565 'display_author_footer' => $display_author_footer,
2566 'display_author_header' => $display_author_header,
2567 'image_aspect_ratio' => esc_attr( auxin_get_option( 'post_image_aspect_ratio' ) ),
2568 'desktop_cnum' => esc_attr( auxin_get_option( 'post_index_column_number' ) ),
2569 'tablet_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_tablet' ) ),
2570 'phone_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_mobile' ) ),
2571 'preview_mode' => 'grid',
2572 'tag' => '',
2573 'reset_query' => false,
2574 'use_wp_query' => true,
2575 'request_from' => 'archive'
2576 );
2577
2578 $result = auxin_widget_recent_posts_callback( $args );
2579 }
2580
2581 return $result;
2582 }
2583
2584 add_filter( 'auxin_blog_archive_custom_template_layouts', 'auxels_add_blog_archive_custom_template_layouts', 10, 2 );
2585
2586 /*-----------------------------------------------------------------------------------*/
2587 /* Filtering wp_title to improve seo and letting seo plugins to filter the output too
2588 /*-----------------------------------------------------------------------------------*/
2589
2590 if( ! defined( 'WPSEO_VERSION') ){
2591
2592 function auxin_wp_title($title, $sep, $seplocation) {
2593 global $page, $paged, $post;
2594
2595 // Don't affect feeds
2596 if ( is_feed() ) return $title;
2597
2598 // Add the blog name
2599 if ( 'right' == $seplocation )
2600 $title .= get_bloginfo( 'name' );
2601 else
2602 $title = get_bloginfo( 'name' ) . $title;
2603
2604 // Add the blog description for the home/front page
2605 $site_description = get_bloginfo( 'description', 'display' );
2606 if ( $site_description && ( is_home() || is_front_page() ) )
2607 $title .= " $sep $site_description";
2608
2609 // Add a page number if necessary
2610 if ( $paged >= 2 || $page >= 2 )
2611 $title .= " $sep " . sprintf( __( 'Page %s', 'auxin-elements'), max( $paged, $page ) );
2612
2613 return $title;
2614 }
2615
2616 add_filter( 'wp_title', 'auxin_wp_title', 10, 3 );
2617 }
2618
2619 /*-----------------------------------------------------------------------------------*/
2620 /* Add new functionality in wp default playlist
2621 /*-----------------------------------------------------------------------------------*/
2622
2623 function auxin_underscore_playlist_templates(){
2624 ?>
2625 <script type="text/html" id="tmpl-wp-playlist-current-item">
2626 <# if ( data.image ) { #>
2627 <img src="{{ data.thumb.src }}" alt="" />
2628 <# } #>
2629 <div class="wp-playlist-caption">
2630 <span class="wp-playlist-item-meta wp-playlist-item-title"><?php
2631 /* translators: playlist item title */
2632 printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{ data.title }}' );
2633 ?></span>
2634 <# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
2635 <# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
2636 </div>
2637 </script>
2638 <script type="text/html" id="tmpl-wp-playlist-item">
2639 <div class="wp-playlist-item">
2640 <#
2641 var isThumbnailExist = data.thumb.src.indexOf("wp-includes/images/media") > 0 ? 'aux-has-no-thubmnail' : '';
2642 #>
2643 <a class="wp-playlist-caption {{ isThumbnailExist }}" href="{{ data.src }}">
2644 <# if ( data.image ) { #>
2645 <img class="wp-playlist-item-artist" src="{{ data.thumb.src }}" alt="{{ data.title }}" />
2646 <# } #>
2647 <# if ( data.meta.length_formatted ) { #>
2648 <span class="wp-playlist-item-length">{{ data.meta.length_formatted }}</span>
2649 <# } #>
2650 </a>
2651 <div class="wp-playlist-item-title" >
2652 <a href="{{ data.src }}">
2653 <h4>
2654 <# if ( data.caption ) { #>
2655 <?php
2656 /* translators: playlist item title */
2657 printf( _x( '%s', 'playlist item title' ), '{{{ data.caption }}}' );
2658 ?>
2659 <# } else { #>
2660 <?php
2661 /* translators: playlist item title */
2662 printf( _x( '%s', 'playlist item title' ), '{{{ data.title }}}' );
2663 ?>
2664 <# } #>
2665 </h4>
2666 </a>
2667 </div>
2668 </div>
2669 </script>
2670 <?php
2671 }
2672
2673 function auxin_modify_wp_playlist_scripts(){
2674 remove_action ( 'wp_footer' , 'wp_underscore_playlist_templates' , 0 );
2675 remove_action ( 'admin_footer' , 'wp_underscore_playlist_templates' , 0 );
2676 add_action ( 'wp_footer' , 'auxin_underscore_playlist_templates' , 0 );
2677 add_action ( 'admin_footer' , 'auxin_underscore_playlist_templates' , 0 );
2678 }
2679 add_action( 'wp_playlist_scripts', 'auxin_modify_wp_playlist_scripts', 15 );
2680
2681 /*-----------------------------------------------------------------------------------*/
2682 /* Redirects a 404 page to the custom one if available
2683 /*-----------------------------------------------------------------------------------*/
2684
2685 function auxin_redirect_custom_404_page() {
2686
2687 if( 'default' !== $custom_404_page = auxin_get_option( 'auxin_404_page', 'default ') ) {
2688 if( is_404() ){
2689 wp_redirect( get_permalink( $custom_404_page ) );
2690 exit();
2691 }
2692 global $post;
2693
2694 if( ! empty( $post->ID ) && $post->ID == $custom_404_page ){
2695 status_header(404);
2696 nocache_headers();
2697 }
2698 }
2699
2700 }
2701 add_action( 'template_redirect', 'auxin_redirect_custom_404_page' );
2702
2703 /*-----------------------------------------------------------------------------------*/
2704
2705 /**
2706 * Loads a PHP file which includes special functionalities for a custom site
2707 * @return void
2708 */
2709 function load_special_demo_functionality(){
2710 if( auxin_get_option( 'special_php_file_enabled', 0 ) ){
2711 $file_path = THEME_CUSTOM_DIR .'/'. auxin_get_option('special_php_file_name', 'functions') .'.php';
2712 if( file_exists( $file_path ) ){
2713 include_once $file_path;
2714 }
2715 }
2716 }
2717 add_action( 'auxin_loaded', 'load_special_demo_functionality' );
2718
2719
2720 /**
2721 * Automatically clear autoptimizeCache if it goes beyond 256MB
2722 *
2723 * @return void
2724 */
2725 function auxin_maybe_flush_autoptimize_big_cache(){
2726 // Check transient
2727 if ( false === auxin_get_transient( 'auxin_maybe_flush_autoptimize_cache' ) ) {
2728
2729 if ( class_exists('autoptimizeCache') ) {
2730 $theMaxSize = 256000;
2731 $statArr = autoptimizeCache::stats();
2732 $cacheSize = round($statArr[1]/1024);
2733
2734 if ( $cacheSize > $theMaxSize ){
2735 autoptimizeCache::clearall();
2736 # Refresh the page so that autoptimize can create new cache files and it does breaks the page after clearall.
2737 header("Refresh:0");
2738 }
2739 }
2740 auxin_set_transient( 'auxin_maybe_flush_autoptimize_cache', 2 * DAY_IN_SECONDS );
2741 }
2742
2743 }
2744
2745 add_action( 'auxin_loaded', 'auxin_maybe_flush_autoptimize_big_cache' );
2746
2747 /*-----------------------------------------------------------------------------------*/
2748
2749 /**
2750 * Replace the primary logo on the page if custom logo was specified
2751 *
2752 * @param int $logo_id The current primary logo ID
2753 * @param array $args The primary logo args
2754 * @return int The primary logo ID
2755 */
2756 function auxin_page_custom_primary_logo_id( $logo_id ){
2757 global $post;
2758
2759 if( empty( $post->ID ) ){
2760 return $logo_id;
2761 }
2762
2763 // Check if the custom logo for page is enabled
2764 if( ! auxin_is_true( auxin_get_post_meta( $post, 'aux_use_custom_logo', 0 ) ) ){
2765 return $logo_id;
2766 }
2767
2768 if( ( $custom_logo_id = auxin_get_post_meta( $post, 'aux_custom_logo' ) ) && is_numeric( $custom_logo_id ) ){
2769 return $custom_logo_id;
2770 }
2771
2772 return $logo_id;
2773 }
2774
2775 add_filter( 'theme_mod_custom_logo', 'auxin_page_custom_primary_logo_id' );
2776
2777
2778 /**
2779 * Replace the custom logo on the page if custom logo was specified
2780 *
2781 * @param int $logo_id The current secondary logo ID
2782 * @param array $args The secondary logo args
2783 * @return int The secondary logo ID
2784 */
2785 function auxin_page_custom_secondary_logo_id( $logo_id, $args ){
2786 global $post;
2787
2788 if( empty( $post->ID ) ){
2789 return $logo_id;
2790 }
2791
2792 // Check if the custom logo for page is enabled
2793 if( ! auxin_is_true( auxin_get_post_meta( $post, 'aux_use_custom_logo', 0 ) ) ){
2794 return $logo_id;
2795 }
2796
2797 if( $custom_logo_id = auxin_get_post_meta( $post, 'aux_custom_logo2' ) ){
2798 return $custom_logo_id;
2799 }
2800
2801 return $logo_id;
2802 }
2803
2804 add_filter( 'auxin_secondary_logo_id', 'auxin_page_custom_secondary_logo_id', 10, 2 );
2805
2806 /*-----------------------------------------------------------------------------------*/
2807
2808 /*-----------------------------------------------------------------------------------*/
2809 /* Function For Checking is website on maintenance mode
2810 /*-----------------------------------------------------------------------------------*/
2811
2812 function auxin_is_maintenance() {
2813 if ( ( function_exists('auxin_get_option') && auxin_get_option('auxin_maintenance_enable', '0') ) || file_exists( ABSPATH . '.maintenance' ) ){
2814 return true;
2815 } else {
2816 return false;
2817 }
2818
2819 }
2820 add_action( 'get_header', 'auxin_is_maintenance' );
2821
2822 /*-----------------------------------------------------------------------------------*/
2823 /* Fixing a fatal error while saving the content with page builder enabled
2824 /*-----------------------------------------------------------------------------------*/
2825
2826 function auxin_load_template_function_for_page_builders(){
2827 if( is_admin() ){
2828 locate_template( AUXIN_INC . 'include/templates/templates-header.php', true, true );
2829 locate_template( AUXIN_INC . 'include/templates/templates-post.php' , true, true );
2830 locate_template( AUXIN_INC . 'include/templates/templates-footer.php', true, true );
2831 }
2832 }
2833 add_action('save_post', 'auxin_load_template_function_for_page_builders', 7, 1);
2834 add_action('wp_ajax_wpseo_filter_shortcodes', 'auxin_load_template_function_for_page_builders', 7, 1);
2835
2836 /*-----------------------------------------------------------------------------------*/
2837 /* Function For Let the user To use custom page for Maintenance and Comingsoon
2838 /*-----------------------------------------------------------------------------------*/
2839 //
2840 function auxin_custom_maintenance_page() {
2841
2842 if( auxin_is_maintenance() && !current_user_can('manage_options') ){
2843
2844 global $wp;
2845
2846 $page = auxin_get_option( 'auxin_maintenance_page', 'default');
2847 $url = get_permalink( $page );
2848 $url_protocols = array( 'http://', 'https://' );
2849 $url_str = str_replace( $url_protocols, '', $url );
2850 $current_url = trailingslashit( add_query_arg( [], home_url( $wp->request ) ) );
2851 $current_url = str_replace( $url_protocols, '', $current_url );
2852
2853 /* Tell search engines that the site is temporarily unavailable */
2854 $protocol = wp_get_server_protocol();
2855
2856 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) {
2857 $protocol = 'HTTP/1.0';
2858 }
2859
2860 header( "$protocol 503 Service Unavailable", true, 503 );
2861 header( 'Content-Type: text/html; charset=utf-8' );
2862
2863 if ( 'default' !== $page && ( $current_url !== $url_str ) ){
2864 header( "Location: " .$url );
2865 exit();
2866 } else if ( 'default' === $page ) {
2867 include auxin_get_template_file( 'maintenance' , '', AUXELS()->template_path() );
2868 }
2869 }
2870
2871 }
2872
2873 add_action( 'wp', 'auxin_custom_maintenance_page');
2874
2875 /*-----------------------------------------------------------------------------------*/
2876
2877
2878 /**
2879 * Add Subfooter and Subfooter bar to Wocommerce templates
2880 */
2881
2882 function auxin_display_shop_footer_sidebar() {
2883 get_sidebar('footer');
2884 }
2885
2886 add_action( 'woocommerce_sidebar', 'auxin_display_shop_footer_sidebar', 10 );
2887
2888
2889
2890 /*-----------------------------------------------------------------------------------*/
2891 /* Star Rating Markup for WooCommerce
2892 /*-----------------------------------------------------------------------------------*/
2893
2894 function auxin_get_star_rating_html( $rating_html, $rating ){
2895
2896 if ( $rating > 0 ) {
2897
2898 // Round Rating value to neareset value 1.5 => 1.5 , 1.8 => 2 , 1.1 => 1
2899 $decimal_value = $rating - floor($rating) ;
2900
2901 if ( 0.5 != $decimal_value ) {
2902 $rating = round( ( $rating * 2 ) / 2 ) ;
2903 }
2904
2905 $rating_html = '<div class="aux-rating-box aux-star-rating">';
2906 $rating_html .= '<span class="aux-star-rating-avg" style="width: ' . ( $rating / 5 ) * 100 .'%">';
2907 $rating_html .= '</span>';
2908 $rating_html .= '</div>';
2909 } else {
2910 $rating_html = '';
2911 }
2912
2913 return $rating_html;
2914 }
2915
2916 add_filter( 'woocommerce_product_get_rating_html', 'auxin_get_star_rating_html', 10, 2 );
2917
2918 /*-----------------------------------------------------------------------------------*/
2919 /* Enable ajax add to cart on free version
2920 /*-----------------------------------------------------------------------------------*/
2921 function auxels_enable_woocommerce_ajax_add_to_cart( $args ){
2922 global $product;
2923 $isAjaxEnabled = class_exists( 'AUXSHP' ) ? auxin_is_true( auxin_get_option( 'product_index_ajax_add_to_cart', '1' ) ) : auxin_is_true( get_option( 'woocommerce_enable_ajax_add_to_cart' ) );
2924 $args['class'] = implode( ' ', array_filter( array(
2925 'button',
2926 $isAjaxEnabled ? 'aux-ajax-add-to-cart' : '',
2927 'product_type_' . $product->get_type(),
2928 $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : ''
2929 ) ) );
2930
2931 $args['attributes']['data-product-type'] = $product->get_type();
2932 $args['attributes']['data-verify_nonce'] = wp_create_nonce( 'aux_add_to_cart-' . $product->get_id() );
2933
2934 return $args;
2935 }
2936
2937 add_filter( 'woocommerce_loop_add_to_cart_args', 'auxels_enable_woocommerce_ajax_add_to_cart', 10 );
2938
2939 /*-----------------------------------------------------------------------------------*/
2940 /* Change Products Title Dom
2941 /*-----------------------------------------------------------------------------------*/
2942 add_action( 'init', 'auxin_remove_default_woocommerce_product_title' );
2943
2944 function auxin_remove_default_woocommerce_product_title() {
2945 remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
2946 add_action( 'woocommerce_shop_loop_item_title', 'auxin_woocommerce_template_loop_product_title', 10 );
2947 }
2948
2949 function auxin_woocommerce_template_loop_product_title() {
2950 global $product;
2951 $dom = '<a href="' . esc_url( get_permalink( $product->get_id() ) ) . '"><h2 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h2></a>';
2952 echo apply_filters( 'auxin_woocommerce_template_loop_product_title', $dom );
2953 }
2954
2955 /**
2956 * Override inner body sections hooks for replace header&footer
2957 *
2958 * @return void
2959 */
2960 function auxin_override_inner_body_sections(){
2961
2962 global $post, $aux_main_post;
2963 $aux_main_post = $post;
2964
2965 if( ! class_exists( '\Elementor\Plugin' ) ){
2966 return;
2967 }
2968
2969 if ( 'default' === $use_legacy_header = auxin_get_post_meta( $post, 'page_header_use_legacy', 'default' ) ) {
2970 $use_legacy_header = auxin_get_option('site_header_use_legacy');
2971 }
2972
2973 if( ! auxin_is_true( $use_legacy_header ) ) {
2974 remove_action( 'auxin_after_inner_body_open', 'auxin_the_top_header_section', 4 );
2975 remove_action( 'auxin_after_inner_body_open', 'auxin_the_main_header_section', 4 );
2976 if ( ! class_exists( '\ElementorPro\Plugin' ) || empty( ElementorPro\Modules\ThemeBuilder\Module::instance()->get_conditions_manager()->get_documents_for_location( 'header' ) ) ) {
2977 add_action( 'auxin_after_inner_body_open', 'auxin_get_header_template', 4 );
2978 }
2979 }
2980 if ( 'default' === $use_legacy_footer = auxin_get_post_meta( $post, 'page_footer_use_legacy', 'default' ) ) {
2981 $use_legacy_footer = auxin_get_option('site_footer_use_legacy');
2982 }
2983
2984 if( ! auxin_is_true( $use_legacy_footer ) ) {
2985 remove_action( 'auxin_before_the_footer', 'auxin_the_site_footer' );
2986 if ( ! class_exists( '\ElementorPro\Plugin' ) || empty( ElementorPro\Modules\ThemeBuilder\Module::instance()->get_conditions_manager()->get_documents_for_location( 'footer' ) ) ) {
2987 add_action( 'auxin_before_the_footer', 'auxin_get_footer_template' );
2988 }
2989 }
2990 }
2991 add_action( 'wp', 'auxin_override_inner_body_sections' );
2992
2993 /**
2994 * Add canvas on elementor single template
2995 *
2996 * @param string $single_template
2997 * @return string
2998 */
2999 function auxin_load_canvas_template( $single_template ) {
3000 global $post;
3001
3002 if ( 'elementor_library' === $post->post_type && defined( 'ELEMENTOR_PATH' ) && defined( 'AUXIN_ELEMENTOR_TEMPLATE' ) ) {
3003 $template_type = get_post_meta( $post->ID, '_elementor_template_type', true );
3004 // Limit the template types
3005 if( ! in_array( $template_type, array( 'header', 'footer' ) ) ){
3006 return $single_template;
3007 }
3008 // Load elementor canvas template
3009 $elementor_2_0_canvas = ELEMENTOR_PATH . '/modules/page-templates/templates/canvas.php';
3010 if ( file_exists( $elementor_2_0_canvas ) ) {
3011 return $elementor_2_0_canvas;
3012 } else {
3013 return ELEMENTOR_PATH . '/includes/page-templates/canvas.php';
3014 }
3015 }
3016
3017 return $single_template;
3018 }
3019 add_filter( 'single_template', 'auxin_load_canvas_template' );
3020
3021
3022 /*-----------------------------------------------------------------------------------*/
3023 /* override the canvas template of elementor plugin
3024 /*-----------------------------------------------------------------------------------*/
3025
3026 function auxin_override_elementor_canvas_template( $template ){
3027
3028 if ( false !== strpos( $template, '/templates/canvas.php' ) ) {
3029 $template = AUXELS_PUB_DIR . '/templates/elementor/canvas.php';
3030 }
3031
3032 return $template;
3033 }
3034 add_filter( 'template_include', 'auxin_override_elementor_canvas_template', 12 );
3035
3036 /* -------------------------------------------------------------------------- */
3037 /* override default wordpress archive link for custom post types */
3038 /* -------------------------------------------------------------------------- */
3039
3040 function auxin_override_post_types_archive_link( $link, $post_type ) {
3041 if ( $post_type == 'portfolio' && auxin_is_true( auxin_get_option('portfolio_show_custom_archive_link') && ! empty( auxin_get_option( 'portfolio_custom_archive_link' ) ) ) ) {
3042 return get_permalink( auxin_get_option( 'portfolio_custom_archive_link' ) );
3043 }
3044
3045 if ( $post_type == 'news' && auxin_is_true( auxin_get_option('news_show_custom_archive_link') && ! empty( auxin_get_option( 'news_custom_archive_link' ) ) ) ) {
3046 return get_permalink( auxin_get_option( 'news_custom_archive_link' ) );
3047 }
3048
3049 return $link;
3050 }
3051 add_filter( 'post_type_archive_link', 'auxin_override_post_types_archive_link', 10, 2 );
3052
3053 function auxels_improve_usage_feedback( $args ) {
3054 // collect theme name and version
3055 if ( false == $transient = auxin_get_transient( 'auxels_usage_trac' ) ) {
3056 $migrated = ( THEME_ID == 'phlox-pro' && ! empty( get_option( 'theme_mods_phlox' ) ) ) ? true : false;
3057 $args['body']['client_meta']['migrated'] = $migrated;
3058
3059 $last_imported_demo = get_option( 'auxin_last_imported_demo', '' );
3060 if ( ! empty( $last_imported_demo ) && $last_imported_demo['id'] ) {
3061 $args['body']['client_meta'][ THEME_ID . '_imported_demo_id' ] = $last_imported_demo['id'];
3062 }
3063
3064 // plugins usage
3065 $plugins = [
3066 'Auxin Portfolio' => 'auxin-portfolio/auxin-portfolio.php',
3067 'Auxin Shop' => 'auxin-shop/auxin-shop.php',
3068 'Auxin News' => 'auxin-News/auxin-News.php',
3069 'WpBakery' => 'js_composer/js_composer.php',
3070 'Revolution Slider' => 'revslider/revslider.php',
3071 'SiteOrigin' => 'siteorigin-panels/siteorigin-panels.php',
3072 'Element Pack' => 'bdthemes-element-pack/bdthemes-element-pack.php',
3073 'Yellow Pencil' => 'waspthemes-yellow-pencil/yellow-pencil.php',
3074 'WooCommerce' => 'woocommerce/woocommerce.php',
3075 'Elementor' => 'elementor/elementor.php',
3076 'Elementor Pro' => 'elementor-pro/elementor-pro.php'
3077 ];
3078 foreach ( $plugins as $name => $plugin ) {
3079 if ( ! is_plugin_active( $plugin ) ) {
3080 unset( $plugins[ $name ] );
3081 }
3082 }
3083 $args['body']['client_meta']['plugins'] = $plugins;
3084
3085 // options usage
3086 $deprecated_options = [
3087 'header' => 'site_header_use_legacy',
3088 'footer' => 'site_footer_use_legacy'
3089 ];
3090 foreach( $deprecated_options as $key => $option ) {
3091 $args['body']['client_meta'][ 'has_dep_' . $key ] = auxin_is_true( auxin_get_option( $option ) ) ? 1 : 0;
3092 }
3093
3094 // post-types and title bar settings usage
3095 $args['body']['client_meta']['post-types'] = [
3096 'post' => [ 'num' => 0, 'title-bar' => 0 ],
3097 'page' => [ 'num' => 0, 'title-bar' => 0 ],
3098 'portfolio' => [ 'num' => 0, 'title-bar' => 0 ],
3099 'product' => [ 'num' => 0, 'title-bar' => 0 ],
3100 'news' => [ 'num' => 0, 'title-bar' => 0 ],
3101 'faq' => [ 'num' => 0, 'title-bar' => 0 ]
3102 ];
3103 foreach ( $args['body']['client_meta']['post-types'] as $key => $post_type ) {
3104 if ( ! post_type_exists( $post_type ) ) {
3105 continue;
3106 }
3107
3108 $query = new WP_Query( array( 'post_type' => $post_type, 'posts_per_page' => -1 ) );
3109 $args['body']['client_meta']['post-types'][ $key ]['num'] = $query->found_posts;
3110
3111 $title_bar_usage = 0;
3112 $title_bar_show = auxin_get_option( $post_type . '_show_title_bar' );
3113
3114 if ( $query->have_posts() ) {
3115 while( $query->have_posts() ) {
3116 $query->the_post();
3117
3118 if ( ( 'default' == $meta_title_bar = get_post_meta( get_the_ID(), 'aux_show_title_bar' ) ) && auxin_is_true( $title_bar_show ) ) {
3119 ++$title_bar_usage;
3120 } elseif ( auxin_is_true( $meta_title_bar ) ) {
3121 ++$title_bar_usage;
3122 }
3123 }
3124 }
3125 $args['body']['client_meta']['post-types'][ $key ]['title-bar'] = $title_bar_usage;
3126 wp_reset_postdata();
3127 }
3128
3129 $slug = THEME_PRO ? 'pro' : 'free';
3130 $args['body']['client_meta']['init_date_' . $slug] = get_theme_mod( 'initial_date_' . $slug , current_time( 'mysql' ) );
3131 $args['body']['client_meta']['init_version_' . $slug] = get_theme_mod( 'initial_version_' . $slug, THEME_VERSION );
3132
3133 auxin_set_transient( 'auxels_usage_trac', $args['body']['client_meta'], DAY_IN_SECONDS );
3134
3135 } else {
3136 $args['body']['client_meta'] = $transient;
3137 }
3138 return $args;
3139
3140 }
3141 add_filter( 'auxels_version_check_args', 'auxels_improve_usage_feedback' );
3142
3143 /*-----------------------------------------------------------------------------------*/
3144 /* Add header and footer edit link in admin bar
3145 /*-----------------------------------------------------------------------------------*/
3146 add_action( 'admin_bar_menu', 'auxin_add_admin_bar_header_footer_edit_link', 100);
3147
3148 function auxin_add_admin_bar_header_footer_edit_link() {
3149 global $wp_admin_bar, $post;
3150
3151 if ( !is_super_admin() || !is_admin_bar_showing() || is_admin() )
3152 return;
3153
3154 if ( 'default' === $use_legacy_header = auxin_get_post_meta( $post, 'page_header_use_legacy', 'default' ) ) {
3155 $use_legacy_header = auxin_get_option('site_header_use_legacy');
3156 }
3157
3158 if ( 'default' === $use_legacy_footer = auxin_get_post_meta( $post, 'page_footer_use_legacy', 'default' ) ) {
3159 $use_legacy_footer = auxin_get_option('site_footer_use_legacy');
3160 }
3161
3162 $template = [];
3163
3164 if ( get_post_type( $post ) == 'page' ) {
3165 if ( ! auxin_is_true( $use_legacy_header) && ( $current_header = auxin_get_post_meta( $post, 'page_elementor_header_template' ) ) && is_numeric( $current_header ) ) {
3166 $template['current']['header'] = $current_header;
3167 }
3168
3169 if ( ! auxin_is_true( $use_legacy_footer) && ( $current_footer = auxin_get_post_meta( $post, 'page_elementor_footer_template' ) ) && is_numeric( $current_footer ) ) {
3170 $template['current']['footer'] = $current_footer;
3171 }
3172 }
3173
3174 if ( ! auxin_is_true( auxin_get_option('site_header_use_legacy') ) && $global_header = auxin_get_option('site_elementor_header_template', '' ) ) {
3175 $template['global']['header'] = $global_header;
3176 }
3177
3178 if ( ! auxin_is_true( auxin_get_option('site_footer_use_legacy') ) && $global_footer = auxin_get_option('site_elementor_footer_template', '' ) ) {
3179 $template['global']['footer'] = $global_footer;
3180 }
3181
3182 if ( ! empty( $template['current'] ) ) {
3183
3184 foreach( $template['current'] as $key => $value ) {
3185 if ( empty( $value ) ) continue;
3186 $args[] = [
3187 'id' => 'aux-current-' . $key ,
3188 'title' => sprintf( '<span>%s</span><span class="aux-state">%s</span>', get_the_title( $value ), __( 'current ', 'auxin-elements' ) . $key ) ,
3189 'parent' => 'aux-header-footer',
3190 'href' => get_edit_post_link( $value ),
3191 'meta' => [
3192 'target' => '_blank'
3193 ]
3194 ];
3195 }
3196 }
3197
3198 if ( ! empty( $template['global'] ) ) {
3199
3200 foreach( $template['global'] as $key => $value ) {
3201 if ( empty( $value ) ) continue;
3202 $args[] = [
3203 'id' => 'aux-global-' . $key ,
3204 'title' => sprintf( '<span>%s</span><span class="aux-state">%s</span>', get_the_title( $value ), $key ) ,
3205 'parent' => 'aux-header-footer',
3206 'href' => get_edit_post_link( $value ),
3207 'meta' => [
3208 'target' => '_blank'
3209 ]
3210 ];
3211 }
3212 }
3213
3214 if ( ! empty( $args ) ) {
3215 $wp_admin_bar->add_node(
3216 [
3217 'id' => 'aux-header-footer',
3218 'title' => sprintf( '<div class="aux-header-footer-edit-links">%s</div>', __( 'Edit Header & Footer', 'auxin-elements' ) ),
3219 'href' => '',
3220 ]
3221 );
3222
3223 foreach ( $args as $arg ) {
3224 $wp_admin_bar->add_node( $arg );
3225 }
3226 }
3227 }
3228
3229 function auxels_add_svg_upload_permission( $mimes ){
3230 $mimes['svg'] = 'image/svg+xml';
3231 return $mimes;
3232 }
3233 add_filter( 'upload_mimes', 'auxels_add_svg_upload_permission' );
3234
3235
3236 /**
3237 * Add classes to wc product items
3238 *
3239 * @param array $classes
3240 * @return array $classes
3241 */
3242 function auxels_add_product_item_classes( $classes ) {
3243
3244 if( !auxin_is_true( auxin_get_option( 'product_archive_show_view_cart_link', false ) ) ) {
3245 $classes[] = 'aux-remove-view-cart';
3246 }
3247
3248 return $classes;
3249 }
3250 add_filter( 'woocommerce_post_class', 'auxels_add_product_item_classes', 1, 1 );
3251
3252 /**
3253 * Add our wishlist class to ti wishlist button
3254 *
3255 * @param string $button
3256 * @return string $button
3257 */
3258 function auxin_modify_ti_wishlist_button( $button ) {
3259
3260 $button = str_replace( 'tinvwl_add_to_wishlist_button', 'tinvwl_add_to_wishlist_button auxshp-wishlist ' , $button );
3261 $button = str_replace( 'tinvwl_add_to_wishlist-text', 'tinvwl_add_to_wishlist-text auxshp-wishlist-text ', $button );
3262 if ( is_singular( 'product' ) ) {
3263 $button = str_replace( '</a>', '<span class="auxshp-sw-icon auxshp-wishlist-icon ' . auxin_get_option( 'product_single_wishlist_button_icon', 'auxicon-heart-2' ) . '"></span></a>', $button );
3264 } else {
3265 $class = function_exists('is_shop') && is_shop() ? 'auxshp-sw-icon auxshp-wishlist-icon auxicon-heart-2' : 'aux-wishlist-icon aux-ico auxicon-heart-small-outline';
3266 $button = str_replace( '</a>', '<span class="' . $class . '"></span></a>', $button );
3267 }
3268 return $button;
3269 }
3270 add_filter( 'tinvwl_wishlist_button', 'auxin_modify_ti_wishlist_button', 1, 1 );
3271
3272 /*-----------------------------------------------------------------------------------*/
3273 /* Injects Custom css for login page
3274 /*-----------------------------------------------------------------------------------*/
3275
3276 function auxels_add_login_style_to_head() {
3277 $inline_css = auxin_get_option( 'auxin_login_style' );
3278 if ( !empty( $inline_css ) ) {
3279 wp_add_inline_style( 'login', $inline_css );
3280 }
3281
3282 }
3283 add_action( 'login_enqueue_scripts','auxels_add_login_style_to_head' );
3284
3285
3286 /**
3287 * Skip generating image sizes for gif files
3288 */
3289 function auxels_disable_upload_sizes( $sizes, $metadata ) {
3290
3291 // Get filetype data.
3292 $filetype = wp_check_filetype($metadata['file']);
3293
3294 // Check if is gif.
3295 if($filetype['type'] == 'image/gif') {
3296 // Unset sizes if file is gif.
3297 $sizes = array();
3298 }
3299
3300 // Return sizes you want to create from image (None if image is gif.)
3301 return $sizes;
3302 }
3303 add_filter('intermediate_image_sizes_advanced', 'auxels_disable_upload_sizes', 10, 2);