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