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