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