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