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