classes
8 years ago
elements
8 years ago
define.php
8 years ago
general-functions.php
8 years ago
general-hooks.php
8 years ago
general-shortcodes.php
9 years ago
index.php
8 years ago
general-hooks.php
2328 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Before Single Products Summary Div |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author |
| 9 | * @link http://averta.net/phlox/ |
| 10 | * @copyright (c) 2010-2017 |
| 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><script></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><script></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 add your Google analytics code here.%s DO NOT use %s tag.', 'auxin-elements'), '<br />' , '<code><script></code>' ), |
| 510 | 'id' => 'auxin_user_google_analytics', |
| 511 | 'section' => 'general-section-seo', |
| 512 | 'dependency' => array(), |
| 513 | 'default' => '', |
| 514 | 'transport' => 'postMessage', |
| 515 | 'mode' => 'javascript', |
| 516 | 'button_labels' => array( 'label' => false ), |
| 517 | 'type' => 'code' |
| 518 | ); |
| 519 | |
| 520 | $fields_sections_list['fields'][] = array( |
| 521 | 'title' => __('Google maps API key', 'auxin-elements'), |
| 522 | 'description' => sprintf( |
| 523 | __( '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' ), |
| 524 | '<a href="https://developers.google.com/maps/documentation/javascript/" target="_blank">', |
| 525 | '</a>' |
| 526 | ), |
| 527 | 'id' => 'auxin_google_map_api_key', |
| 528 | 'section' => 'general-section-seo', |
| 529 | 'dependency' => array(), |
| 530 | 'default' => '', |
| 531 | 'transport' => 'postMessage', |
| 532 | 'mode' => 'javascript', |
| 533 | 'type' => 'text' |
| 534 | ); |
| 535 | |
| 536 | $fields_sections_list['fields'][] = array( |
| 537 | 'title' => __('Google marketing code', 'auxin-elements'), |
| 538 | 'description' => sprintf( __('You can add your Google marketing code here.%s DO NOT use %s tag.', 'auxin-elements'), '<br />' , '<code><script></code>' ), |
| 539 | 'id' => 'auxin_user_google_marketing', |
| 540 | 'section' => 'general-section-seo', |
| 541 | 'dependency' => array(), |
| 542 | 'default' => '', |
| 543 | 'transport' => 'postMessage', |
| 544 | 'mode' => 'javascript', |
| 545 | 'button_labels' => array( 'label' => false ), |
| 546 | 'type' => 'code' |
| 547 | ); |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | // Sub section - Button 1 in header ------------------------------- |
| 562 | |
| 563 | $fields_sections_list['sections'][] = array( |
| 564 | 'id' => 'header-section-action-button1', |
| 565 | 'parent' => 'header-section', // section parent's id |
| 566 | 'title' => __( 'Header Button 1', THEME_DOMAIN ), |
| 567 | 'description' => __( 'Setting for Header Button 1', THEME_DOMAIN ) |
| 568 | ); |
| 569 | |
| 570 | $fields_sections_list['fields'][] = array( |
| 571 | 'title' => __('Display Button 1 Header?','auxin-elements' ), |
| 572 | 'description' => __('Enable this option to display a button in header.','auxin-elements' ), |
| 573 | 'section' => 'header-section-action-button1', |
| 574 | 'id' => 'site_header_show_btn1', |
| 575 | 'type' => 'switch', |
| 576 | 'default' => '0', |
| 577 | 'partial' => array( |
| 578 | 'selector' => '.aux-btn1-box', |
| 579 | 'container_inclusive' => true, |
| 580 | 'render_callback' => function(){ echo auxin_get_header_button(1); } |
| 581 | ) |
| 582 | ); |
| 583 | |
| 584 | $fields_sections_list['fields'][] = array( |
| 585 | 'title' => __('Button label','auxin-elements' ), |
| 586 | 'description' => __('Specifies the label of button.','auxin-elements' ), |
| 587 | 'section' => 'header-section-action-button1', |
| 588 | 'id' => 'site_header_btn1_label', |
| 589 | 'type' => 'text', |
| 590 | 'default' => __('Button', 'auxin-elements'), |
| 591 | 'dependency' => array( |
| 592 | array( |
| 593 | 'id' => 'site_header_show_btn1', |
| 594 | 'value' => '1', |
| 595 | 'operator'=> '==' |
| 596 | ) |
| 597 | ), |
| 598 | 'transport' => 'postMessage', |
| 599 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").html( to );' |
| 600 | ); |
| 601 | |
| 602 | $fields_sections_list['fields'][] = array( |
| 603 | 'title' => __('Button size','auxin-elements' ), |
| 604 | 'description' => '', |
| 605 | 'section' => 'header-section-action-button1', |
| 606 | 'id' => 'site_header_btn1_size', |
| 607 | 'type' => 'select', |
| 608 | 'choices' => array( |
| 609 | 'exlarge' => __('Exlarge', 'auxin-elements' ), |
| 610 | 'large' => __('Large' , 'auxin-elements' ), |
| 611 | 'medium' => __('Medium' , 'auxin-elements' ), |
| 612 | 'small' => __('Small' , 'auxin-elements' ), |
| 613 | 'tiny' => __('Tiny' , 'auxin-elements' ) |
| 614 | ), |
| 615 | 'default' => 'large', |
| 616 | 'dependency' => array( |
| 617 | array( |
| 618 | 'id' => 'site_header_show_btn1', |
| 619 | 'value' => '1', |
| 620 | 'operator'=> '==' |
| 621 | ) |
| 622 | ), |
| 623 | 'transport' => 'postMessage', |
| 624 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").removeClass( "aux-exlarge aux-large aux-medium aux-small aux-tiny" ).addClass( "aux-" + to );' |
| 625 | ); |
| 626 | |
| 627 | $fields_sections_list['fields'][] = array( |
| 628 | 'title' => __('Button shape','auxin-elements' ), |
| 629 | 'description' => '', |
| 630 | 'section' => 'header-section-action-button1', |
| 631 | 'id' => 'site_header_btn1_shape', |
| 632 | 'type' => 'radio-image', |
| 633 | 'choices' => array( |
| 634 | '' => array( |
| 635 | 'label' => __('Sharp', 'auxin-elements' ), |
| 636 | 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg' |
| 637 | ), |
| 638 | 'round' => array( |
| 639 | 'label' => __('Round', 'auxin-elements' ), |
| 640 | 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg' |
| 641 | ), |
| 642 | 'curve' => array( |
| 643 | 'label' => __('Curve', 'auxin-elements' ), |
| 644 | 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg' |
| 645 | ) |
| 646 | ), |
| 647 | 'default' => 'curve', |
| 648 | 'dependency' => array( |
| 649 | array( |
| 650 | 'id' => 'site_header_show_btn1', |
| 651 | 'value' => '1', |
| 652 | 'operator'=> '==' |
| 653 | ) |
| 654 | ), |
| 655 | 'transport' => 'postMessage', |
| 656 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").removeClass( "aux-round aux-curve" ).addClass( "aux-" + to );' |
| 657 | ); |
| 658 | |
| 659 | $fields_sections_list['fields'][] = array( |
| 660 | 'title' => __('Button style','auxin-elements' ), |
| 661 | 'description' => '', |
| 662 | 'section' => 'header-section-action-button1', |
| 663 | 'id' => 'site_header_btn1_style', |
| 664 | 'type' => 'radio-image', |
| 665 | 'choices' => array( |
| 666 | '' => array( |
| 667 | 'label' => __('Normal', 'auxin-elements' ), |
| 668 | 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg' |
| 669 | ), |
| 670 | '3d' => array( |
| 671 | 'label' => __('3D', 'auxin-elements' ), |
| 672 | 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg' |
| 673 | ), |
| 674 | 'outline' => array( |
| 675 | 'label' => __('Outline', 'auxin-elements' ), |
| 676 | 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg' |
| 677 | ) |
| 678 | ), |
| 679 | 'default' => '', |
| 680 | 'dependency' => array( |
| 681 | array( |
| 682 | 'id' => 'site_header_show_btn1', |
| 683 | 'value' => '1', |
| 684 | 'operator'=> '==' |
| 685 | ) |
| 686 | ), |
| 687 | 'transport' => 'postMessage', |
| 688 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").removeClass( "aux-3d aux-outline" ).addClass( "aux-" + to );' |
| 689 | ); |
| 690 | |
| 691 | $fields_sections_list['fields'][] = array( |
| 692 | 'title' => __('Darken the label','auxin-elements' ), |
| 693 | 'description' => __('Darken label of button.','auxin-elements' ), |
| 694 | 'section' => 'header-section-action-button1', |
| 695 | 'id' => 'site_header_btn1_darken', |
| 696 | 'type' => 'switch', |
| 697 | 'default' => '0', |
| 698 | 'dependency' => array( |
| 699 | array( |
| 700 | 'id' => 'site_header_show_btn1', |
| 701 | 'value' => '1', |
| 702 | 'operator'=> '==' |
| 703 | ) |
| 704 | ), |
| 705 | 'transport' => 'postMessage', |
| 706 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").toggleClass( "aux-dark-text", to );' |
| 707 | ); |
| 708 | |
| 709 | $fields_sections_list['fields'][] = array( |
| 710 | 'title' => __('Icon for button','auxin-elements' ), |
| 711 | 'description' => '', |
| 712 | 'section' => 'header-section-action-button1', |
| 713 | 'id' => 'site_header_btn1_icon', |
| 714 | 'type' => 'icon', |
| 715 | 'default' => '', |
| 716 | 'dependency' => array( |
| 717 | array( |
| 718 | 'id' => 'site_header_show_btn1', |
| 719 | 'value' => '1', |
| 720 | 'operator'=> '==' |
| 721 | ) |
| 722 | ), |
| 723 | 'transport' => 'refresh' |
| 724 | ); |
| 725 | |
| 726 | $fields_sections_list['fields'][] = array( |
| 727 | 'title' => __('Icon alignment','auxin-elements' ), |
| 728 | 'description' => '', |
| 729 | 'section' => 'header-section-action-button1', |
| 730 | 'id' => 'site_header_btn1_icon_align', |
| 731 | 'type' => 'radio-image', |
| 732 | 'choices' => array( |
| 733 | 'default' => array( |
| 734 | 'label' => __('Default' , 'auxin-elements'), |
| 735 | 'image' => AUXELS_ADMIN_URL . '/assets/images/button.png' |
| 736 | ), |
| 737 | 'left' => array( |
| 738 | 'label' => __('Left' , 'auxin-elements'), |
| 739 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm' |
| 740 | ), |
| 741 | 'right' => array( |
| 742 | 'label' => __('Right' , 'auxin-elements'), |
| 743 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button1.webm webm' |
| 744 | ), |
| 745 | 'over' => array( |
| 746 | 'label' => __('Over', 'auxin-elements'), |
| 747 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button5.webm webm' |
| 748 | ), |
| 749 | 'left-animate' => array( |
| 750 | 'label' => __('Animate from Left', 'auxin-elements'), |
| 751 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button4.webm webm' |
| 752 | ), |
| 753 | 'right-animate' => array( |
| 754 | 'label' => __('Animate from Righ', 'auxin-elements'), |
| 755 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button3.webm webm' |
| 756 | ) |
| 757 | ), |
| 758 | 'default' => 'default', |
| 759 | 'dependency' => array( |
| 760 | array( |
| 761 | 'id' => 'site_header_show_btn1', |
| 762 | 'value' => '1', |
| 763 | 'operator'=> '==' |
| 764 | ) |
| 765 | ), |
| 766 | 'transport' => 'postMessage', |
| 767 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").alterClass( "aux-icon-*", "aux-icon-" + to );' |
| 768 | ); |
| 769 | |
| 770 | $fields_sections_list['fields'][] = array( |
| 771 | 'title' => __('Color of button','auxin-elements' ), |
| 772 | 'description' => '', |
| 773 | 'section' => 'header-section-action-button1', |
| 774 | 'id' => 'site_header_btn1_color_name', |
| 775 | 'type' => 'radio-image', |
| 776 | 'choices' => auxin_get_famous_colors_list(), |
| 777 | 'default' => 'ball-blue', |
| 778 | 'dependency' => array( |
| 779 | array( |
| 780 | 'id' => 'site_header_show_btn1', |
| 781 | 'value' => '1', |
| 782 | 'operator'=> '==' |
| 783 | ) |
| 784 | ), |
| 785 | 'transport' => 'refresh' |
| 786 | ); |
| 787 | |
| 788 | $fields_sections_list['fields'][] = array( |
| 789 | 'title' => __('Button Link','auxin-elements' ), |
| 790 | 'description' => '', |
| 791 | 'section' => 'header-section-action-button1', |
| 792 | 'id' => 'site_header_btn1_link', |
| 793 | 'type' => 'text', |
| 794 | 'default' => '#', |
| 795 | 'dependency' => array( |
| 796 | array( |
| 797 | 'id' => 'site_header_show_btn1', |
| 798 | 'value' => '1', |
| 799 | 'operator'=> '==' |
| 800 | ) |
| 801 | ), |
| 802 | 'transport' => 'postMessage', |
| 803 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").prop( "href", to );' |
| 804 | ); |
| 805 | |
| 806 | $fields_sections_list['fields'][] = array( |
| 807 | 'title' => __('Open link in','auxin-elements' ), |
| 808 | 'description' => '', |
| 809 | 'section' => 'header-section-action-button1', |
| 810 | 'id' => 'site_header_btn1_target', |
| 811 | 'type' => 'select', |
| 812 | 'choices' => array( |
| 813 | '_self' => __('Current page' , 'auxin-elements' ), |
| 814 | '_blank' => __('New page', 'auxin-elements' ) |
| 815 | ), |
| 816 | 'default' => '_self', |
| 817 | 'dependency' => array( |
| 818 | array( |
| 819 | 'id' => 'site_header_show_btn1', |
| 820 | 'value' => '1', |
| 821 | 'operator'=> '==' |
| 822 | ) |
| 823 | ), |
| 824 | 'transport' => 'postMessage', |
| 825 | 'post_js' => '$(".aux-btn1-box .aux-ac-btn1").prop( "target", to );' |
| 826 | ); |
| 827 | |
| 828 | |
| 829 | |
| 830 | // Sub section - Button 2 in header ------------------------------- |
| 831 | |
| 832 | $fields_sections_list['sections'][] = array( |
| 833 | 'id' => 'header-section-action-button2', |
| 834 | 'parent' => 'header-section', // section parent's id |
| 835 | 'title' => __( 'Header Button 2', THEME_DOMAIN ), |
| 836 | 'description' => __( 'Setting for Header Button 2', THEME_DOMAIN ) |
| 837 | ); |
| 838 | |
| 839 | $fields_sections_list['fields'][] = array( |
| 840 | 'title' => __('Display Button 2 Header?','auxin-elements' ), |
| 841 | 'description' => __('Enable this option to display a button in header.','auxin-elements' ), |
| 842 | 'section' => 'header-section-action-button2', |
| 843 | 'id' => 'site_header_show_btn2', |
| 844 | 'type' => 'switch', |
| 845 | 'default' => 0, |
| 846 | 'partial' => array( |
| 847 | 'selector' => '.aux-btn2-box', |
| 848 | 'container_inclusive' => true, |
| 849 | 'render_callback' => function(){ echo auxin_get_header_button(2); } |
| 850 | ) |
| 851 | ); |
| 852 | |
| 853 | $fields_sections_list['fields'][] = array( |
| 854 | 'title' => __('Button label','auxin-elements' ), |
| 855 | 'description' => __('Specifies the label of button.','auxin-elements' ), |
| 856 | 'section' => 'header-section-action-button2', |
| 857 | 'id' => 'site_header_btn2_label', |
| 858 | 'type' => 'text', |
| 859 | 'default' => __('Button', 'auxin-elements'), |
| 860 | 'dependency' => array( |
| 861 | array( |
| 862 | 'id' => 'site_header_show_btn2', |
| 863 | 'value' => 1, |
| 864 | 'operator'=> '==' |
| 865 | ) |
| 866 | ), |
| 867 | 'transport' => 'postMessage', |
| 868 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").html( to );' |
| 869 | ); |
| 870 | |
| 871 | $fields_sections_list['fields'][] = array( |
| 872 | 'title' => __('Button size','auxin-elements' ), |
| 873 | 'description' => '', |
| 874 | 'section' => 'header-section-action-button2', |
| 875 | 'id' => 'site_header_btn2_size', |
| 876 | 'type' => 'select', |
| 877 | 'choices' => array( |
| 878 | 'exlarge' => __('Exlarge', 'auxin-elements' ), |
| 879 | 'large' => __('Large' , 'auxin-elements' ), |
| 880 | 'medium' => __('Medium' , 'auxin-elements' ), |
| 881 | 'small' => __('Small' , 'auxin-elements' ), |
| 882 | 'tiny' => __('Tiny' , 'auxin-elements' ) |
| 883 | ), |
| 884 | 'default' => 'large', |
| 885 | 'dependency' => array( |
| 886 | array( |
| 887 | 'id' => 'site_header_show_btn2', |
| 888 | 'value' => 1, |
| 889 | 'operator'=> '==' |
| 890 | ) |
| 891 | ), |
| 892 | 'transport' => 'postMessage', |
| 893 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").removeClass( "aux-exlarge aux-large aux-medium aux-small aux-tiny" ).addClass( "aux-" + to );' |
| 894 | ); |
| 895 | |
| 896 | $fields_sections_list['fields'][] = array( |
| 897 | 'title' => __('Button shape','auxin-elements' ), |
| 898 | 'description' => '', |
| 899 | 'section' => 'header-section-action-button2', |
| 900 | 'id' => 'site_header_btn2_shape', |
| 901 | 'type' => 'radio-image', |
| 902 | 'choices' => array( |
| 903 | '' => array( |
| 904 | 'label' => __('Sharp', 'auxin-elements' ), |
| 905 | 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg' |
| 906 | ), |
| 907 | 'round' => array( |
| 908 | 'label' => __('Round', 'auxin-elements' ), |
| 909 | 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg' |
| 910 | ), |
| 911 | 'curve' => array( |
| 912 | 'label' => __('Curve', 'auxin-elements' ), |
| 913 | 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg' |
| 914 | ) |
| 915 | ), |
| 916 | 'default' => 'curve', |
| 917 | 'dependency' => array( |
| 918 | array( |
| 919 | 'id' => 'site_header_show_btn2', |
| 920 | 'value' => 1, |
| 921 | 'operator'=> '==' |
| 922 | ) |
| 923 | ), |
| 924 | 'transport' => 'postMessage', |
| 925 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").removeClass( "aux-round aux-curve" ).addClass( "aux-" + to );' |
| 926 | ); |
| 927 | |
| 928 | $fields_sections_list['fields'][] = array( |
| 929 | 'title' => __('Button style','auxin-elements' ), |
| 930 | 'description' => '', |
| 931 | 'section' => 'header-section-action-button2', |
| 932 | 'id' => 'site_header_btn2_style', |
| 933 | 'type' => 'radio-image', |
| 934 | 'choices' => array( |
| 935 | '' => array( |
| 936 | 'label' => __('Normal', 'auxin-elements' ), |
| 937 | 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg' |
| 938 | ), |
| 939 | '3d' => array( |
| 940 | 'label' => __('3D', 'auxin-elements' ), |
| 941 | 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg' |
| 942 | ), |
| 943 | 'outline' => array( |
| 944 | 'label' => __('Outline', 'auxin-elements' ), |
| 945 | 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg' |
| 946 | ) |
| 947 | ), |
| 948 | 'default' => 'outline', |
| 949 | 'dependency' => array( |
| 950 | array( |
| 951 | 'id' => 'site_header_show_btn2', |
| 952 | 'value' => 1, |
| 953 | 'operator'=> '==' |
| 954 | ) |
| 955 | ), |
| 956 | 'transport' => 'postMessage', |
| 957 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").removeClass( "aux-3d aux-outline" ).addClass( "aux-" + to );' |
| 958 | ); |
| 959 | |
| 960 | $fields_sections_list['fields'][] = array( |
| 961 | 'title' => __('Darken the label','auxin-elements' ), |
| 962 | 'description' => __('Darken label of button.','auxin-elements' ), |
| 963 | 'section' => 'header-section-action-button2', |
| 964 | 'id' => 'site_header_btn2_darken', |
| 965 | 'type' => 'switch', |
| 966 | 'default' => '0', |
| 967 | 'dependency' => array( |
| 968 | array( |
| 969 | 'id' => 'site_header_show_btn2', |
| 970 | 'value' => 1, |
| 971 | 'operator'=> '==' |
| 972 | ) |
| 973 | ), |
| 974 | 'transport' => 'postMessage', |
| 975 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").toggleClass( "aux-dark-text", to );' |
| 976 | ); |
| 977 | |
| 978 | $fields_sections_list['fields'][] = array( |
| 979 | 'title' => __('Icon for button','auxin-elements' ), |
| 980 | 'description' => '', |
| 981 | 'section' => 'header-section-action-button2', |
| 982 | 'id' => 'site_header_btn2_icon', |
| 983 | 'type' => 'icon', |
| 984 | 'default' => '', |
| 985 | 'dependency' => array( |
| 986 | array( |
| 987 | 'id' => 'site_header_show_btn2', |
| 988 | 'value' => 1, |
| 989 | 'operator'=> '==' |
| 990 | ) |
| 991 | ), |
| 992 | 'transport' => 'refresh' |
| 993 | ); |
| 994 | |
| 995 | $fields_sections_list['fields'][] = array( |
| 996 | 'title' => __('Icon alignment','auxin-elements' ), |
| 997 | 'description' => '', |
| 998 | 'section' => 'header-section-action-button2', |
| 999 | 'id' => 'site_header_btn2_icon_align', |
| 1000 | 'type' => 'radio-image', |
| 1001 | 'choices' => array( |
| 1002 | 'default' => array( |
| 1003 | 'label' => __('Default' , 'auxin-elements'), |
| 1004 | 'image' => AUXELS_ADMIN_URL . '/assets/images/button.png' |
| 1005 | ), |
| 1006 | 'left' => array( |
| 1007 | 'label' => __('Left' , 'auxin-elements'), |
| 1008 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm' |
| 1009 | ), |
| 1010 | 'right' => array( |
| 1011 | 'label' => __('Right' , 'auxin-elements'), |
| 1012 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm' |
| 1013 | ), |
| 1014 | 'over' => array( |
| 1015 | 'label' => __('Over', 'auxin-elements'), |
| 1016 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button5.webm webm' |
| 1017 | ), |
| 1018 | 'left-animate' => array( |
| 1019 | 'label' => __('Animate from Left', 'auxin-elements'), |
| 1020 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button4.webm webm' |
| 1021 | ), |
| 1022 | 'right-animate' => array( |
| 1023 | 'label' => __('Animate from Righ', 'auxin-elements'), |
| 1024 | 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button3.webm webm' |
| 1025 | ) |
| 1026 | ), |
| 1027 | 'default' => 'default', |
| 1028 | 'dependency' => array( |
| 1029 | array( |
| 1030 | 'id' => 'site_header_show_btn2', |
| 1031 | 'value' => 1, |
| 1032 | 'operator'=> '==' |
| 1033 | ) |
| 1034 | ), |
| 1035 | 'transport' => 'postMessage', |
| 1036 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").alterClass( "aux-icon-*", "aux-icon-" + to );' |
| 1037 | ); |
| 1038 | |
| 1039 | $fields_sections_list['fields'][] = array( |
| 1040 | 'title' => __('Color of button','auxin-elements' ), |
| 1041 | 'description' => '', |
| 1042 | 'section' => 'header-section-action-button2', |
| 1043 | 'id' => 'site_header_btn2_color_name', |
| 1044 | 'type' => 'radio-image', |
| 1045 | 'choices' => auxin_get_famous_colors_list(), |
| 1046 | 'default' => 'emerald', |
| 1047 | 'dependency' => array( |
| 1048 | array( |
| 1049 | 'id' => 'site_header_show_btn2', |
| 1050 | 'value' => 1, |
| 1051 | 'operator'=> '==' |
| 1052 | ) |
| 1053 | ), |
| 1054 | 'transport' => 'refresh' |
| 1055 | ); |
| 1056 | |
| 1057 | $fields_sections_list['fields'][] = array( |
| 1058 | 'title' => __('Button Link','auxin-elements' ), |
| 1059 | 'description' => '', |
| 1060 | 'section' => 'header-section-action-button2', |
| 1061 | 'id' => 'site_header_btn2_link', |
| 1062 | 'type' => 'text', |
| 1063 | 'default' => '', |
| 1064 | 'dependency' => array( |
| 1065 | array( |
| 1066 | 'id' => 'site_header_show_btn2', |
| 1067 | 'value' => 1, |
| 1068 | 'operator'=> '==' |
| 1069 | ) |
| 1070 | ), |
| 1071 | 'transport' => 'postMessage', |
| 1072 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").prop( "href", to );' |
| 1073 | ); |
| 1074 | |
| 1075 | $fields_sections_list['fields'][] = array( |
| 1076 | 'title' => __('Open link in','auxin-elements' ), |
| 1077 | 'description' => '', |
| 1078 | 'section' => 'header-section-action-button2', |
| 1079 | 'id' => 'site_header_btn2_target', |
| 1080 | 'type' => 'select', |
| 1081 | 'choices' => array( |
| 1082 | '_self' => __('Current page' , 'auxin-elements' ), |
| 1083 | '_blank' => __('New page', 'auxin-elements' ) |
| 1084 | ), |
| 1085 | 'default' => '_self', |
| 1086 | 'dependency' => array( |
| 1087 | array( |
| 1088 | 'id' => 'site_header_show_btn2', |
| 1089 | 'value' => 1, |
| 1090 | 'operator'=> '==' |
| 1091 | ) |
| 1092 | ), |
| 1093 | 'transport' => 'postMessage', |
| 1094 | 'post_js' => '$(".aux-btn2-box .aux-ac-btn2").prop( "target", to );' |
| 1095 | ); |
| 1096 | |
| 1097 | |
| 1098 | // Sub section - footer ------------------------------- |
| 1099 | |
| 1100 | |
| 1101 | $fields_sections_list['fields'][] = array( |
| 1102 | 'title' => __('Footer Brand Image', 'auxin-elements'), |
| 1103 | 'description' => __('This image appears as site brand image on footer section.', 'auxin-elements'), |
| 1104 | 'id' => 'site_secondary_logo_image', |
| 1105 | 'section' => 'footer-section-footer', |
| 1106 | 'dependency' => array( |
| 1107 | array( |
| 1108 | 'id' => 'show_site_footer', |
| 1109 | 'value' => array('1'), |
| 1110 | 'operator'=> '==' |
| 1111 | ) |
| 1112 | ), |
| 1113 | 'default' => '', |
| 1114 | 'transport' => 'postMessage', |
| 1115 | 'partial' => array( |
| 1116 | 'selector' => '.aux-logo-footer .aux-logo-anchor', |
| 1117 | 'container_inclusive' => false, |
| 1118 | 'render_callback' => function(){ echo _auxin_get_footer_logo_image(); } |
| 1119 | ), |
| 1120 | 'type' => 'image' |
| 1121 | ); |
| 1122 | |
| 1123 | $fields_sections_list['fields'][] = array( |
| 1124 | 'title' => __('Footer Brand Height', 'auxin-elements'), |
| 1125 | 'description' => __('Specifies maximum height of logo in footer.', 'auxin-elements'), |
| 1126 | 'id' => 'site_secondary_logo_max_height', |
| 1127 | 'section' => 'footer-section-footer', |
| 1128 | 'dependency' => array( |
| 1129 | array( |
| 1130 | 'id' => 'show_site_footer', |
| 1131 | 'value' => array('1'), |
| 1132 | 'operator'=> '==' |
| 1133 | ) |
| 1134 | ), |
| 1135 | 'default' => '50', |
| 1136 | 'transport' => 'postMessage', |
| 1137 | 'post_js' => '$(".aux-logo-footer .aux-logo-anchor img").css( "max-height", $.trim(to) + "px" );', |
| 1138 | 'style_callback' => function( $value = null ){ |
| 1139 | if( ! $value ){ |
| 1140 | $value = auxin_get_option( 'site_secondary_logo_max_height' ); |
| 1141 | } |
| 1142 | $value = trim( $value, 'px'); |
| 1143 | return $value ? ".aux-logo-footer .aux-logo-anchor img { max-height:{$value}px; }" : ''; |
| 1144 | }, |
| 1145 | 'type' => 'text' |
| 1146 | ); |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | // Sub section - Login page customizer ------------------------------- |
| 1152 | |
| 1153 | $fields_sections_list['sections'][] = array( |
| 1154 | 'id' => 'tools-section-login', |
| 1155 | 'parent' => 'tools-section', // section parent's id |
| 1156 | 'title' => __( 'Login Page', 'auxin-elements' ), |
| 1157 | 'description' => __( 'Login page Options', 'auxin-elements' ) |
| 1158 | //'description' => __( 'Preview login page', 'auxin-elements' ), |
| 1159 | //'preview_link' => wp_login_url() |
| 1160 | ); |
| 1161 | |
| 1162 | |
| 1163 | |
| 1164 | $fields_sections_list['fields'][] = array( |
| 1165 | 'title' => __('Login Skin', 'auxin-elements'), |
| 1166 | 'description' => __('Specifies a skin for login page of your website.', 'auxin-elements'), |
| 1167 | 'id' => 'auxin_login_skin', |
| 1168 | 'section' => 'tools-section-login', |
| 1169 | 'dependency' => array(), |
| 1170 | 'choices' => array( |
| 1171 | 'default' => array( |
| 1172 | 'label' => __('Default', 'auxin-elements'), |
| 1173 | 'image' => AUXIN_URL . 'images/visual-select/login-skin-default.svg' |
| 1174 | ), |
| 1175 | 'clean-white' => array( |
| 1176 | 'label' => __('Clean white', 'auxin-elements'), |
| 1177 | 'image' => AUXIN_URL . 'images/visual-select/login-skin-light.svg' |
| 1178 | ), |
| 1179 | 'simple-white' => array( |
| 1180 | 'label' => __('Simple white', 'auxin-elements'), |
| 1181 | 'image' => AUXIN_URL . 'images/visual-select/login-skin-simple-light.svg' |
| 1182 | ), |
| 1183 | 'simple-gray' => array( |
| 1184 | 'label' => __('Simple gray', 'auxin-elements'), |
| 1185 | 'image' => AUXIN_URL . 'images/visual-select/login-skin-simple-gray.svg' |
| 1186 | ) |
| 1187 | ), |
| 1188 | 'transport' => 'refresh', |
| 1189 | 'default' => 'default', |
| 1190 | 'type' => 'radio-image' |
| 1191 | ); |
| 1192 | |
| 1193 | $fields_sections_list['fields'][] = array( |
| 1194 | 'title' => __('Login message', 'auxin-elements'), |
| 1195 | 'description' => __('Enter a text to display above the login form.', 'auxin-elements'), |
| 1196 | 'id' => 'auxin_login_message', |
| 1197 | 'section' => 'tools-section-login', |
| 1198 | 'dependency' => array(), |
| 1199 | 'transport' => 'refresh', |
| 1200 | 'type' => 'textarea', |
| 1201 | 'default' => '' |
| 1202 | ); |
| 1203 | |
| 1204 | //-------------------------------- |
| 1205 | |
| 1206 | $fields_sections_list['fields'][] = array( |
| 1207 | 'title' => __('Login Page Logo', 'auxin-elements'), |
| 1208 | 'description' => __('Specifies a logo to display on login page.(width of logo image could be up to 320px)', 'auxin-elements'), |
| 1209 | 'id' => 'auxin_login_logo_image', |
| 1210 | 'section' => 'tools-section-login', |
| 1211 | 'dependency' => array(), |
| 1212 | 'transport' => 'refresh', |
| 1213 | 'default' => '', |
| 1214 | 'type' => 'image' |
| 1215 | ); |
| 1216 | |
| 1217 | |
| 1218 | $fields_sections_list['fields'][] = array( |
| 1219 | 'title' => __('Logo Width', 'auxin-elements'), |
| 1220 | 'description' => __('Specifies width of logo image in pixel.', 'auxin-elements'), |
| 1221 | 'id' => 'auxin_login_logo_width', |
| 1222 | 'section' => 'tools-section-login', |
| 1223 | 'dependency' => array(), |
| 1224 | 'transport' => 'refresh', |
| 1225 | 'default' => '84', |
| 1226 | 'type' => 'text' |
| 1227 | ); |
| 1228 | |
| 1229 | |
| 1230 | $fields_sections_list['fields'][] = array( |
| 1231 | 'title' => __('Logo Height', 'auxin-elements'), |
| 1232 | 'description' => __('Specifies height of logo image in pixel.', 'auxin-elements'), |
| 1233 | 'id' => 'auxin_login_logo_height', |
| 1234 | 'section' => 'tools-section-login', |
| 1235 | 'dependency' => array(), |
| 1236 | 'transport' => 'refresh', |
| 1237 | 'default' => '84', |
| 1238 | 'type' => 'text' |
| 1239 | ); |
| 1240 | |
| 1241 | //-------------------------------- |
| 1242 | |
| 1243 | $fields_sections_list['fields'][] = array( |
| 1244 | 'title' => __('Enable Background', 'auxin-elements'), |
| 1245 | 'description' => __('Enable it to display custom background on login page.', 'auxin-elements'), |
| 1246 | 'id' => 'auxin_login_bg_show', |
| 1247 | 'section' => 'tools-section-login', |
| 1248 | 'type' => 'switch', |
| 1249 | 'transport' => 'refresh', |
| 1250 | 'wrapper_class' => 'collapse-head', |
| 1251 | 'default' => '0' |
| 1252 | ); |
| 1253 | |
| 1254 | |
| 1255 | $fields_sections_list['fields'][] = array( |
| 1256 | 'title' => __( 'Background Color', 'auxin-elements'), |
| 1257 | 'description' => __( 'Specifies background color of website.', 'auxin-elements'), |
| 1258 | 'id' => 'auxin_login_bg_color', |
| 1259 | 'section' => 'tools-section-login', |
| 1260 | 'type' => 'color', |
| 1261 | 'dependency' => array( |
| 1262 | array( |
| 1263 | 'id' => 'auxin_login_bg_show', |
| 1264 | 'value' => array( '1' ) |
| 1265 | ) |
| 1266 | ), |
| 1267 | 'transport' => 'refresh', |
| 1268 | 'default' => '' |
| 1269 | ); |
| 1270 | |
| 1271 | $fields_sections_list['fields'][] = array( |
| 1272 | 'title' => __('Background Image', 'auxin-elements'), |
| 1273 | 'description' => __('You can upload custom image for background of login page', 'auxin-elements'), |
| 1274 | 'id' => 'auxin_login_bg_image', |
| 1275 | 'section' => 'tools-section-login', |
| 1276 | 'type' => 'image', |
| 1277 | 'dependency' => array( |
| 1278 | array( |
| 1279 | 'id' => 'auxin_login_bg_show', |
| 1280 | 'value' => array( '1' ) |
| 1281 | ) |
| 1282 | ), |
| 1283 | 'transport' => 'refresh', |
| 1284 | 'default' => '' |
| 1285 | ); |
| 1286 | |
| 1287 | $fields_sections_list['fields'][] = array( |
| 1288 | 'title' => __('Background Size', 'auxin-elements'), |
| 1289 | 'description' => __('Specifies background size on login page.', 'auxin-elements'), |
| 1290 | 'id' => 'auxin_login_bg_size', |
| 1291 | 'section' => 'tools-section-login', |
| 1292 | 'type' => 'radio-image', |
| 1293 | 'choices' => array( |
| 1294 | 'auto' => array( |
| 1295 | 'label' => __('Auto', 'auxin-elements'), |
| 1296 | 'css_class' => 'axiAdminIcon-bg-size-1', |
| 1297 | ), |
| 1298 | 'contain' => array( |
| 1299 | 'label' => __('Contain', 'auxin-elements'), |
| 1300 | 'css_class' => 'axiAdminIcon-bg-size-2' |
| 1301 | ), |
| 1302 | 'cover' => array( |
| 1303 | 'label' => __('Cover', 'auxin-elements'), |
| 1304 | 'css_class' => 'axiAdminIcon-bg-size-3' |
| 1305 | ) |
| 1306 | ), |
| 1307 | 'dependency' => array( |
| 1308 | array( |
| 1309 | 'id' => 'auxin_login_bg_show', |
| 1310 | 'value' => array( '1' ) |
| 1311 | ) |
| 1312 | ), |
| 1313 | 'transport' => 'refresh', |
| 1314 | 'default' => 'auto' |
| 1315 | ); |
| 1316 | |
| 1317 | $fields_sections_list['fields'][] = array( |
| 1318 | 'title' => __('Background Pattern', 'auxin-elements'), |
| 1319 | '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>'), |
| 1320 | 'id' => 'auxin_login_bg_pattern', |
| 1321 | 'section' => 'tools-section-login', |
| 1322 | 'choices' => auxin_get_background_patterns( array( 'none' => array( 'label' =>__('None', 'auxin-elements'), 'image' => AUXIN_URL . 'images/visual-select/none-pattern.svg' ) ), 'before' ), |
| 1323 | 'type' => 'radio-image', |
| 1324 | 'dependency' => array( |
| 1325 | array( |
| 1326 | 'id' => 'auxin_login_bg_show', |
| 1327 | 'value' => array( '1' ) |
| 1328 | ) |
| 1329 | ), |
| 1330 | 'transport' => 'refresh', |
| 1331 | 'default' => '' |
| 1332 | ); |
| 1333 | |
| 1334 | $fields_sections_list['fields'][] = array( |
| 1335 | 'title' => __( 'Background Repeat', 'auxin-elements'), |
| 1336 | 'description' => __( 'Specifies how background image repeats.', 'auxin-elements'), |
| 1337 | 'id' => 'auxin_login_bg_repeat', |
| 1338 | 'section' => 'tools-section-login', |
| 1339 | 'choices' => array( |
| 1340 | 'no-repeat' => array( |
| 1341 | 'label' => __('No repeat', 'auxin-elements'), |
| 1342 | 'css_class' => 'axiAdminIcon-none', |
| 1343 | ), |
| 1344 | 'repeat' => array( |
| 1345 | 'label' => __('Repeat horizontally and vertically', 'auxin-elements'), |
| 1346 | 'css_class' => 'axiAdminIcon-repeat-xy', |
| 1347 | ), |
| 1348 | 'repeat-x' => array( |
| 1349 | 'label' => __('Repeat horizontally', 'auxin-elements'), |
| 1350 | 'css_class' => 'axiAdminIcon-repeat-x', |
| 1351 | ), |
| 1352 | 'repeat-y' => array( |
| 1353 | 'label' => __('Repeat vertically', 'auxin-elements'), |
| 1354 | 'css_class' => 'axiAdminIcon-repeat-y', |
| 1355 | ) |
| 1356 | ), |
| 1357 | 'type' => 'radio-image', |
| 1358 | 'dependency' => array( |
| 1359 | array( |
| 1360 | 'id' => 'auxin_login_bg_show', |
| 1361 | 'value' => array( '1' ) |
| 1362 | ) |
| 1363 | ), |
| 1364 | 'transport' => 'refresh', |
| 1365 | 'default' => 'no-repeat' |
| 1366 | ); |
| 1367 | |
| 1368 | $fields_sections_list['fields'][] = array( |
| 1369 | 'title' => __( 'Background Position', 'auxin-elements'), |
| 1370 | 'description' => __('Specifies background image position.', 'auxin-elements'), |
| 1371 | 'id' => 'auxin_login_bg_position', |
| 1372 | 'section' => 'tools-section-login', |
| 1373 | 'choices' => array( |
| 1374 | 'left top' => array( |
| 1375 | 'label' => __('Left top', 'auxin-elements'), |
| 1376 | 'css_class' => 'axiAdminIcon-top-left' |
| 1377 | ), |
| 1378 | 'center top' => array( |
| 1379 | 'label' => __('Center top', 'auxin-elements'), |
| 1380 | 'css_class' => 'axiAdminIcon-top-center' |
| 1381 | ), |
| 1382 | 'right top' => array( |
| 1383 | 'label' => __('Right top', 'auxin-elements'), |
| 1384 | 'css_class' => 'axiAdminIcon-top-right' |
| 1385 | ), |
| 1386 | |
| 1387 | 'left center' => array( |
| 1388 | 'label' => __('Left center', 'auxin-elements'), |
| 1389 | 'css_class' => 'axiAdminIcon-center-left' |
| 1390 | ), |
| 1391 | 'center center' => array( |
| 1392 | 'label' => __('Center center', 'auxin-elements'), |
| 1393 | 'css_class' => 'axiAdminIcon-center-center' |
| 1394 | ), |
| 1395 | 'right center' => array( |
| 1396 | 'label' => __('Right center', 'auxin-elements'), |
| 1397 | 'css_class' => 'axiAdminIcon-center-right' |
| 1398 | ), |
| 1399 | |
| 1400 | 'left bottom' => array( |
| 1401 | 'label' => __('Left bottom', 'auxin-elements'), |
| 1402 | 'css_class' => 'axiAdminIcon-bottom-left' |
| 1403 | ), |
| 1404 | 'center bottom' => array( |
| 1405 | 'label' => __('Center bottom', 'auxin-elements'), |
| 1406 | 'css_class' => 'axiAdminIcon-bottom-center' |
| 1407 | ), |
| 1408 | 'right bottom' => array( |
| 1409 | 'label' => __('Right bottom', 'auxin-elements'), |
| 1410 | 'css_class' => 'axiAdminIcon-bottom-right' |
| 1411 | ) |
| 1412 | ), |
| 1413 | 'type' => 'radio-image', |
| 1414 | 'dependency' => array( |
| 1415 | array( |
| 1416 | 'id' => 'auxin_login_bg_show', |
| 1417 | 'value' => array( '1' ) |
| 1418 | ) |
| 1419 | ), |
| 1420 | 'transport' => 'refresh', |
| 1421 | 'default' => 'left top' |
| 1422 | ); |
| 1423 | |
| 1424 | $fields_sections_list['fields'][] = array( |
| 1425 | 'title' => __('Background Attachment', 'auxin-elements'), |
| 1426 | 'description' => __('Specifies whether the background is fixed or scrollable as user scrolls the page.', 'auxin-elements'), |
| 1427 | 'id' => 'auxin_login_bg_attach', |
| 1428 | 'section' => 'tools-section-login', |
| 1429 | 'type' => 'radio-image', |
| 1430 | 'choices' => array( |
| 1431 | 'scroll' => array( |
| 1432 | 'label' => __('Scroll', 'auxin-elements'), |
| 1433 | 'css_class' => 'axiAdminIcon-bg-attachment-scroll', |
| 1434 | ), |
| 1435 | 'fixed' => array( |
| 1436 | 'label' => __('Fixed', 'auxin-elements'), |
| 1437 | 'css_class' => 'axiAdminIcon-bg-attachment-fixed', |
| 1438 | ) |
| 1439 | ), |
| 1440 | 'dependency' => array( |
| 1441 | array( |
| 1442 | 'id' => 'auxin_login_bg_show', |
| 1443 | 'value' => array( '1' ) |
| 1444 | ) |
| 1445 | ), |
| 1446 | 'transport' => 'refresh', |
| 1447 | 'default' => 'scroll' |
| 1448 | ); |
| 1449 | |
| 1450 | //-------------------------------- |
| 1451 | |
| 1452 | $fields_sections_list['fields'][] = array( |
| 1453 | 'title' => __('Custom CSS class name', 'auxin-elements'), |
| 1454 | 'description' => __('In this field you can define custom CSS class name for login page. |
| 1455 | This class name will be added to body classes in login page and is useful for advance custom styling purposes.', 'auxin-elements'), |
| 1456 | 'id' => 'auxin_login_body_class', |
| 1457 | 'section' => 'tools-section-login', |
| 1458 | 'dependency' => array(), |
| 1459 | 'transport' => 'refresh', |
| 1460 | 'default' => '', |
| 1461 | 'type' => 'text' |
| 1462 | ); |
| 1463 | |
| 1464 | |
| 1465 | return $fields_sections_list; |
| 1466 | } |
| 1467 | |
| 1468 | add_filter( 'auxin_defined_option_fields_sections', 'auxin_add_theme_options_in_plugin', 12, 1 ); |
| 1469 | |
| 1470 | |
| 1471 | |
| 1472 | |
| 1473 | |
| 1474 | /*-----------------------------------------------------------------------------------*/ |
| 1475 | /* Injects JavaScript codes from theme options in head |
| 1476 | /*-----------------------------------------------------------------------------------*/ |
| 1477 | |
| 1478 | function auxin_ele_add_js_to_head() { |
| 1479 | if( $inline_js = auxin_get_option( 'auxin_user_custom_js_head' ) ){ |
| 1480 | echo '<script>'. $inline_js .'</script>'; |
| 1481 | } |
| 1482 | } |
| 1483 | add_action( 'wp_head','auxin_ele_add_js_to_head' ); |
| 1484 | |
| 1485 | |
| 1486 | /*-----------------------------------------------------------------------------------*/ |
| 1487 | /* Injects JavaScript codes from theme options in JS file |
| 1488 | /*-----------------------------------------------------------------------------------*/ |
| 1489 | |
| 1490 | function auxin_ele_add_theme_options_to_js_file( $js ){ |
| 1491 | $js['theme_options_custom'] = auxin_get_option( 'auxin_user_custom_js' ); |
| 1492 | |
| 1493 | $js['theme_options_google_analytics'] = auxin_get_option( 'auxin_user_google_analytics' ); |
| 1494 | $js['theme_options_google_marketing'] = auxin_get_option( 'auxin_user_google_marketing' ); |
| 1495 | |
| 1496 | return $js; |
| 1497 | } |
| 1498 | add_filter( 'auxin_custom_js_file_content', 'auxin_ele_add_theme_options_to_js_file' ); |
| 1499 | |
| 1500 | |
| 1501 | /*-----------------------------------------------------------------------------------*/ |
| 1502 | /* Adds the custom CSS class of the login page to body element |
| 1503 | /*-----------------------------------------------------------------------------------*/ |
| 1504 | |
| 1505 | function auxin_login_body_class( $classes ){ |
| 1506 | |
| 1507 | if( $custom_class = auxin_get_option('auxin_login_body_class' ) ){ |
| 1508 | $classes['auxin_custom'] = $custom_class; |
| 1509 | } |
| 1510 | |
| 1511 | if( $custom_skin = auxin_get_option('auxin_login_skin' ) ){ |
| 1512 | $classes['auxin_skin'] = esc_attr( 'auxin-login-skin-' . $custom_skin ); |
| 1513 | } |
| 1514 | |
| 1515 | return $classes; |
| 1516 | } |
| 1517 | add_action( 'auxin_functions_ready', function(){ |
| 1518 | add_filter( 'login_body_class', 'auxin_login_body_class' ); |
| 1519 | }); |
| 1520 | |
| 1521 | |
| 1522 | |
| 1523 | /*-----------------------------------------------------------------------------------*/ |
| 1524 | /* Adds proper styles for background and logo on login page |
| 1525 | /*-----------------------------------------------------------------------------------*/ |
| 1526 | |
| 1527 | function auxin_login_head(){ |
| 1528 | |
| 1529 | $styles = ''; |
| 1530 | |
| 1531 | if( $bg_image_id = auxin_get_option( 'auxin_login_logo_image' ) ){ |
| 1532 | $bg_image = wp_get_attachment_url( $bg_image_id ); |
| 1533 | $styles .= "background-image: url( $bg_image ); "; |
| 1534 | |
| 1535 | $bg_width = auxin_get_option( 'auxin_login_logo_width' , '84' ); |
| 1536 | $bg_height = auxin_get_option( 'auxin_login_logo_height', '84' ); |
| 1537 | |
| 1538 | $bg_width = rtrim( $bg_width , 'px' ) . 'px'; |
| 1539 | $bg_height = rtrim( $bg_height, 'px' ) . 'px'; |
| 1540 | |
| 1541 | $styles .= "background-size: $bg_width $bg_height; "; |
| 1542 | $styles .= "width: $bg_width; height: $bg_height; "; |
| 1543 | |
| 1544 | echo "<style>#login h1 a { $styles }</style>"; |
| 1545 | } |
| 1546 | |
| 1547 | if( auxin_get_option( 'auxin_login_bg_show' ) ){ |
| 1548 | |
| 1549 | // get styles for background image |
| 1550 | $bg_styles = auxin_generate_styles_for_backgroud_fields( 'auxin_login_bg', 'option', array( |
| 1551 | 'color' => 'auxin_login_bg_color', |
| 1552 | 'image' => 'auxin_login_bg_image', |
| 1553 | 'repeat' => 'auxin_login_bg_repeat', |
| 1554 | 'size' => 'auxin_login_bg_size', |
| 1555 | 'position' => 'auxin_login_bg_position', |
| 1556 | 'attachment' => 'auxin_login_bg_attachment', |
| 1557 | 'clip' => 'auxin_login_bg_clip' |
| 1558 | ) ); |
| 1559 | |
| 1560 | $pattern_style = auxin_generate_styles_for_backgroud_fields( 'auxin_login_bg', 'option', array( |
| 1561 | 'pattern' => 'auxin_login_bg_pattern' |
| 1562 | ) ); |
| 1563 | |
| 1564 | echo "<style>body.login { $bg_styles } body.login:before { $pattern_style }</style>"; |
| 1565 | } |
| 1566 | |
| 1567 | } |
| 1568 | add_action( 'auxin_functions_ready', function(){ |
| 1569 | add_action( 'login_head', 'auxin_login_head' ); |
| 1570 | }); |
| 1571 | |
| 1572 | |
| 1573 | /*-----------------------------------------------------------------------------------*/ |
| 1574 | /* Changes the login header url to home url |
| 1575 | /*-----------------------------------------------------------------------------------*/ |
| 1576 | |
| 1577 | function auxin_login_headerurl( $login_header_url ){ |
| 1578 | |
| 1579 | if ( ! is_multisite() ) { |
| 1580 | $login_header_url = home_url(); |
| 1581 | } |
| 1582 | return $login_header_url; |
| 1583 | } |
| 1584 | add_action( 'auxin_functions_ready', function(){ |
| 1585 | add_filter( 'login_headerurl', 'auxin_login_headerurl' ); |
| 1586 | }); |
| 1587 | |
| 1588 | /*-----------------------------------------------------------------------------------*/ |
| 1589 | /* Changes the login header url to home url |
| 1590 | /*-----------------------------------------------------------------------------------*/ |
| 1591 | |
| 1592 | function auxin_login_headertitle( $login_header_title ){ |
| 1593 | |
| 1594 | if ( ! is_multisite() ) { |
| 1595 | $login_header_title = get_bloginfo( 'name' ); |
| 1596 | } |
| 1597 | return $login_header_title; |
| 1598 | } |
| 1599 | add_action( 'auxin_functions_ready', function(){ |
| 1600 | add_filter( 'login_headertitle', 'auxin_login_headertitle' ); |
| 1601 | }); |
| 1602 | |
| 1603 | /*-----------------------------------------------------------------------------------*/ |
| 1604 | /* Adds custom message above the login form |
| 1605 | /*-----------------------------------------------------------------------------------*/ |
| 1606 | |
| 1607 | function auxin_login_message( $login_message ){ |
| 1608 | |
| 1609 | if( $custom_message = auxin_get_option( 'auxin_login_message' ) ){ |
| 1610 | |
| 1611 | $message_wrapper_start = '<div class="message">'; |
| 1612 | $message_wrapper_end = "</div>\n"; |
| 1613 | |
| 1614 | $custom_message_markup = $message_wrapper_start . $custom_message . $message_wrapper_end; |
| 1615 | |
| 1616 | /** |
| 1617 | * Filter instructional messages displayed above the login form. |
| 1618 | * |
| 1619 | * @param string $custom_message Login message. |
| 1620 | */ |
| 1621 | $login_message .= apply_filters( 'auxin_login_message', $custom_message_markup, $custom_message, $message_wrapper_start, $message_wrapper_end ); |
| 1622 | } |
| 1623 | |
| 1624 | return $login_message; |
| 1625 | } |
| 1626 | add_action( 'auxin_functions_ready', function(){ |
| 1627 | add_filter( 'login_message', 'auxin_login_message' ); |
| 1628 | }); |
| 1629 | |
| 1630 | |
| 1631 | /*-----------------------------------------------------------------------------------*/ |
| 1632 | /* Prints the custom js codes of a single page to the source page |
| 1633 | /*-----------------------------------------------------------------------------------*/ |
| 1634 | |
| 1635 | function auxin_custom_js_for_pages( $js, $post ){ |
| 1636 | // The custom JS code for specific page |
| 1637 | if( $post && ! is_404() && is_singular() ) { |
| 1638 | $js .= get_post_meta( $post->ID, 'aux_page_custom_js', true ); |
| 1639 | } |
| 1640 | return $js; |
| 1641 | } |
| 1642 | add_filter( 'auxin_footer_inline_script', 'auxin_custom_js_for_pages', 15, 2 ); |
| 1643 | |
| 1644 | |
| 1645 | /*-----------------------------------------------------------------------------------*/ |
| 1646 | /* Add preconnect for Google Fonts. |
| 1647 | /*-----------------------------------------------------------------------------------*/ |
| 1648 | |
| 1649 | /** |
| 1650 | * Add preconnect for Google Fonts. |
| 1651 | * |
| 1652 | * @param array $urls URLs to print for resource hints. |
| 1653 | * @param string $relation_type The relation type the URLs are printed. |
| 1654 | * @return array $urls URLs to print for resource hints. |
| 1655 | */ |
| 1656 | function auxin_resource_hints( $urls, $relation_type ) { |
| 1657 | if ( wp_style_is( 'auxin-fonts-google', 'queue' ) && 'preconnect' === $relation_type ) { |
| 1658 | $urls[] = array( |
| 1659 | 'href' => 'https://fonts.gstatic.com', |
| 1660 | 'crossorigin', |
| 1661 | ); |
| 1662 | } |
| 1663 | return $urls; |
| 1664 | } |
| 1665 | //add_filter( 'wp_resource_hints', 'auxin_resource_hints', 10, 2 ); |
| 1666 | |
| 1667 | |
| 1668 | /*-----------------------------------------------------------------------------------*/ |
| 1669 | /* Setup Header |
| 1670 | /*-----------------------------------------------------------------------------------*/ |
| 1671 | |
| 1672 | function auxin_after_setup_theme_extra(){ |
| 1673 | // gererate shortcodes in widget text |
| 1674 | add_filter('widget_text', 'do_shortcode'); |
| 1675 | } |
| 1676 | add_action( 'after_setup_theme', 'auxin_after_setup_theme_extra' ); |
| 1677 | |
| 1678 | /*-----------------------------------------------------------------------------------*/ |
| 1679 | /* add excerpts to pages |
| 1680 | /*-----------------------------------------------------------------------------------*/ |
| 1681 | |
| 1682 | function auxin_add_excerpts_to_pages() { |
| 1683 | add_post_type_support( 'page', 'excerpt' ); |
| 1684 | } |
| 1685 | add_action( 'init', 'auxin_add_excerpts_to_pages' ); |
| 1686 | |
| 1687 | |
| 1688 | /*-----------------------------------------------------------------------------------*/ |
| 1689 | /* Add some user contact fields |
| 1690 | /*-----------------------------------------------------------------------------------*/ |
| 1691 | |
| 1692 | function auxin_user_contactmethods($user_contactmethods){ |
| 1693 | $user_contactmethods['twitter'] = __('Twitter' , 'auxin-elements'); |
| 1694 | $user_contactmethods['facebook'] = __('Facebook' , 'auxin-elements'); |
| 1695 | $user_contactmethods['googleplus'] = __('Google Plus', 'auxin-elements'); |
| 1696 | $user_contactmethods['flickr'] = __('Flickr' , 'auxin-elements'); |
| 1697 | $user_contactmethods['delicious'] = __('Delicious' , 'auxin-elements'); |
| 1698 | $user_contactmethods['pinterest'] = __('Pinterest' , 'auxin-elements'); |
| 1699 | $user_contactmethods['github'] = __('GitHub' , 'auxin-elements'); |
| 1700 | $user_contactmethods['skills'] = __('Skills' , 'auxin-elements'); |
| 1701 | |
| 1702 | return $user_contactmethods; |
| 1703 | } |
| 1704 | add_filter('user_contactmethods', 'auxin_user_contactmethods'); |
| 1705 | |
| 1706 | |
| 1707 | /*-----------------------------------------------------------------------------------*/ |
| 1708 | /* Add home page menu arg to menu item list |
| 1709 | /*-----------------------------------------------------------------------------------*/ |
| 1710 | |
| 1711 | function auxin_add_home_page_to_menu_args( $args ) { |
| 1712 | $args['show_home'] = true; |
| 1713 | return $args; |
| 1714 | } |
| 1715 | add_filter( 'wp_page_menu_args', 'auxin_add_home_page_to_menu_args' ); |
| 1716 | |
| 1717 | /*-----------------------------------------------------------------------------------*/ |
| 1718 | /* Print meta tags to preview post while sharing on facebook |
| 1719 | /*-----------------------------------------------------------------------------------*/ |
| 1720 | |
| 1721 | if( ! defined('WPSEO_VERSION') && ! class_exists('All_in_One_SEO_Pack') ){ |
| 1722 | |
| 1723 | function auxin_facebook_header_meta (){ |
| 1724 | |
| 1725 | if( ! defined('AUXIN_VERSION') ){ |
| 1726 | return; |
| 1727 | } |
| 1728 | |
| 1729 | // return if built-in seo is disabled or "SEO by yoast" is active |
| 1730 | if( ! auxin_get_option( 'enable_theme_seo', 1 ) ) return; |
| 1731 | |
| 1732 | global $post; |
| 1733 | if( ! isset( $post ) || ! is_singular() || is_search() || is_404() ) return; |
| 1734 | setup_postdata( $post ); |
| 1735 | |
| 1736 | $featured_image = auxin_get_the_post_thumbnail_src( $post->ID, 90, 90, true, 90 ); |
| 1737 | $post_excerpt = get_the_excerpt(); |
| 1738 | ?> |
| 1739 | <meta name="title" content="<?php echo esc_attr( $post->post_title ); ?>" /> |
| 1740 | <meta name="description" content="<?php echo esc_attr( $post_excerpt ); ?>" /> |
| 1741 | <?php if( $featured_image) { ?> |
| 1742 | <link rel="image_src" href="<?php echo $featured_image; ?>" /> |
| 1743 | <?php } |
| 1744 | |
| 1745 | } |
| 1746 | |
| 1747 | add_action( 'wp_head', 'auxin_facebook_header_meta' ); |
| 1748 | } |
| 1749 | |
| 1750 | /*-----------------------------------------------------------------------------------*/ |
| 1751 | /* Add SiteOrigin class prefix and custom field classes path |
| 1752 | /*-----------------------------------------------------------------------------------*/ |
| 1753 | if ( auxin_is_plugin_active( 'so-widgets-bundle/so-widgets-bundle.php') ) { |
| 1754 | |
| 1755 | function auxels_register_auxin_siteorigin_class_prefix( $class_prefixes ) { |
| 1756 | $class_prefixes[] = 'Auxin_SiteOrigin_Field_'; |
| 1757 | return $class_prefixes; |
| 1758 | } |
| 1759 | |
| 1760 | add_filter( 'siteorigin_widgets_field_class_prefixes', 'auxels_register_auxin_siteorigin_class_prefix' ); |
| 1761 | |
| 1762 | |
| 1763 | function auxels_register_custom_fields( $class_paths ) { |
| 1764 | $class_paths[] = AUXELS_ADMIN_DIR . '/includes/compatibility/siteorigin/fields/'; |
| 1765 | return $class_paths; |
| 1766 | } |
| 1767 | |
| 1768 | add_filter( 'siteorigin_widgets_field_class_paths', 'auxels_register_custom_fields' ); |
| 1769 | } |
| 1770 | |
| 1771 | |
| 1772 | /** |
| 1773 | * Replace WooCommerce Default Pagination with auxin pagination |
| 1774 | * |
| 1775 | */ |
| 1776 | remove_action( 'woocommerce_pagination' , 'woocommerce_pagination', 10 ); |
| 1777 | add_action ( 'woocommerce_pagination', 'auxin_woocommerce_pagination' , 10 ); |
| 1778 | |
| 1779 | function auxin_woocommerce_pagination() { |
| 1780 | auxin_the_paginate_nav( |
| 1781 | array( 'css_class' => auxin_get_option('archive_pagination_skin') ) |
| 1782 | ); |
| 1783 | } |
| 1784 | |
| 1785 | /*-----------------------------------------------------------------------------------*/ |
| 1786 | /* the function runs when auxin framework loaded |
| 1787 | /*-----------------------------------------------------------------------------------*/ |
| 1788 | |
| 1789 | function auxin_on_auxin_fw_admin_loaded(){ |
| 1790 | |
| 1791 | // assign theme custom capabilities to roles on first run |
| 1792 | if( ! auxin_get_theme_mod( 'are_auxin_caps_assigned', 0 ) ){ |
| 1793 | add_action( 'admin_init' , 'auxin_assign_default_caps_for_post_types' ); |
| 1794 | set_theme_mod( 'are_auxin_caps_assigned', 1 ); |
| 1795 | } |
| 1796 | } |
| 1797 | |
| 1798 | add_action( 'auxin_admin_loaded', 'auxin_on_auxin_fw_admin_loaded' ); |
| 1799 | |
| 1800 | |
| 1801 | /*-------------------------------------------------------------------------------*/ |
| 1802 | /* assigns theme custom post types capabilities to main roles |
| 1803 | /*-------------------------------------------------------------------------------*/ |
| 1804 | |
| 1805 | function auxin_assign_default_caps_for_post_types() { |
| 1806 | $auxin_registered_post_types = auxin_registered_post_types(true); |
| 1807 | |
| 1808 | // the roles to add capabilities of custom post types to |
| 1809 | $roles = array('administrator', 'editor'); |
| 1810 | |
| 1811 | foreach ( $roles as $role_name ) { |
| 1812 | |
| 1813 | $role = get_role( $role_name ); |
| 1814 | |
| 1815 | // loop through custom post types and add custom capabilities to defined rules |
| 1816 | foreach ( $auxin_registered_post_types as $post_type ) { |
| 1817 | |
| 1818 | $post_type_object = get_post_type_object( $post_type ); |
| 1819 | // add post type capabilities to role |
| 1820 | foreach ( $post_type_object->cap as $cap_key => $cap ) { |
| 1821 | if( ! in_array( $cap_key, array( 'edit_post', 'delete_post', 'read_post' ) ) ) |
| 1822 | $role->add_cap( $cap ); |
| 1823 | } |
| 1824 | } |
| 1825 | |
| 1826 | } |
| 1827 | } |
| 1828 | |
| 1829 | |
| 1830 | |
| 1831 | |
| 1832 | |
| 1833 | function auxels_add_post_type_metafields(){ |
| 1834 | |
| 1835 | $all_post_types = auxin_get_possible_post_types(true); |
| 1836 | |
| 1837 | $auxin_is_admin = is_admin(); |
| 1838 | |
| 1839 | foreach ( $all_post_types as $post_type => $is_post_type_allowed ) { |
| 1840 | |
| 1841 | if( ! $is_post_type_allowed ){ |
| 1842 | continue; |
| 1843 | } |
| 1844 | |
| 1845 | // define metabox args |
| 1846 | $metabox_args = array( 'post_type' => $post_type ); |
| 1847 | |
| 1848 | switch( $post_type ) { |
| 1849 | |
| 1850 | case 'page': |
| 1851 | |
| 1852 | $metabox_args['hub_id'] = 'axi_meta_hub_page'; |
| 1853 | $metabox_args['hub_title'] = __('Page Options', 'auxin-elements'); |
| 1854 | $metabox_args['to_post_types'] = array( $post_type ); |
| 1855 | |
| 1856 | break; |
| 1857 | |
| 1858 | case 'post': |
| 1859 | |
| 1860 | $metabox_args['hub_id'] = 'axi_meta_hub_post'; |
| 1861 | $metabox_args['hub_title'] = __('Post Options', 'auxin-elements'); |
| 1862 | $metabox_args['to_post_types'] = array( $post_type ); |
| 1863 | |
| 1864 | default: |
| 1865 | break; |
| 1866 | } |
| 1867 | |
| 1868 | // Load metabox fields on admin |
| 1869 | if( $auxin_is_admin ){ |
| 1870 | auxin_maybe_render_metabox_hub_for_post_type( $metabox_args ); |
| 1871 | } |
| 1872 | |
| 1873 | } |
| 1874 | |
| 1875 | } |
| 1876 | |
| 1877 | //add_action( 'init', 'auxels_add_post_type_metafields' ); |
| 1878 | |
| 1879 | /*-----------------------------------------------------------------------------------*/ |
| 1880 | /* Add custom blog page tamplate |
| 1881 | /*-----------------------------------------------------------------------------------*/ |
| 1882 | |
| 1883 | /** |
| 1884 | * Add custom page templates |
| 1885 | * |
| 1886 | * @param string $result The current custom blog page template markup |
| 1887 | * @param string $page_template The name of page template |
| 1888 | * |
| 1889 | * @return string The markup for current page template |
| 1890 | */ |
| 1891 | function auxels_blog_page_templates( $result, $page_template ){ |
| 1892 | |
| 1893 | // page number |
| 1894 | $paged = max( 1, get_query_var('paged'), get_query_var('page') ); |
| 1895 | |
| 1896 | // posts perpage |
| 1897 | $per_page = get_option( 'posts_per_page' ); |
| 1898 | |
| 1899 | // if template type is masonry |
| 1900 | if( strpos( $page_template, 'blog-type-6' ) ){ |
| 1901 | |
| 1902 | $args = array( |
| 1903 | 'title' => '', |
| 1904 | 'num' => $per_page, |
| 1905 | 'paged' => $paged, |
| 1906 | 'order_by' => 'menu_order date', |
| 1907 | 'order' => 'desc', |
| 1908 | 'show_media' => true, |
| 1909 | 'exclude_without_media' => 0, |
| 1910 | 'exclude_custom_post_formats' => 0, |
| 1911 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 0 ) ), |
| 1912 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 1913 | 'show_title' => true, |
| 1914 | 'show_info' => true, |
| 1915 | 'show_readmore' => true, |
| 1916 | 'show_author_footer' => false, |
| 1917 | 'tag' => '', |
| 1918 | 'reset_query' => true |
| 1919 | ); |
| 1920 | |
| 1921 | // get the shortcode base blog page |
| 1922 | $result = auxin_widget_recent_posts_masonry_callback( $args ); |
| 1923 | } |
| 1924 | |
| 1925 | // if template type is tiles |
| 1926 | elseif( strpos( $page_template, 'blog-type-9' ) ){ |
| 1927 | |
| 1928 | $args = array( |
| 1929 | 'title' => '', |
| 1930 | 'num' => $per_page, |
| 1931 | 'paged' => $paged, |
| 1932 | 'order_by' => 'menu_order date', |
| 1933 | 'order' => 'desc', |
| 1934 | 'show_media' => true, |
| 1935 | 'exclude_without_media' => 0, |
| 1936 | 'exclude_custom_post_formats' => 0, |
| 1937 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 0 ) ), |
| 1938 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 1939 | 'show_title' => true, |
| 1940 | 'show_info' => true, |
| 1941 | 'show_readmore' => true, |
| 1942 | 'show_author_footer' => false, |
| 1943 | 'tag' => '', |
| 1944 | 'reset_query' => true |
| 1945 | ); |
| 1946 | |
| 1947 | // get the shortcode base blog page |
| 1948 | $result = auxin_widget_recent_posts_tiles_callback( $args ); |
| 1949 | } |
| 1950 | |
| 1951 | // if template type is land |
| 1952 | elseif( strpos( $page_template, 'blog-type-8' ) ){ |
| 1953 | |
| 1954 | $args = array( |
| 1955 | 'title' => '', |
| 1956 | 'num' => $per_page, |
| 1957 | 'paged' => $paged, |
| 1958 | 'order_by' => 'menu_order date', |
| 1959 | 'order' => 'desc', |
| 1960 | 'show_media' => true, |
| 1961 | 'exclude_without_media' => 0, |
| 1962 | 'exclude_custom_post_formats' => 0, |
| 1963 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 0 ) ), |
| 1964 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 1965 | 'show_excerpt' => true, |
| 1966 | 'excerpt_len' => '160', |
| 1967 | 'show_title' => true, |
| 1968 | 'show_info' => true, |
| 1969 | 'show_readmore' => true, |
| 1970 | 'show_author_footer' => false, |
| 1971 | 'tag' => '', |
| 1972 | 'reset_query' => true |
| 1973 | ); |
| 1974 | |
| 1975 | // get the shortcode base blog page |
| 1976 | $result = auxin_widget_recent_posts_land_style_callback( $args ); |
| 1977 | } |
| 1978 | |
| 1979 | // if template type is timeline |
| 1980 | elseif( strpos( $page_template, 'blog-type-7' ) ){ |
| 1981 | |
| 1982 | $args = array( |
| 1983 | 'title' => '', |
| 1984 | 'num' => $per_page, |
| 1985 | 'paged' => $paged, |
| 1986 | 'order_by' => 'menu_order date', |
| 1987 | 'order' => 'desc', |
| 1988 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ), |
| 1989 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 1990 | 'show_media' => true, |
| 1991 | 'show_excerpt' => true, |
| 1992 | 'excerpt_len' => '160', |
| 1993 | 'show_title' => true, |
| 1994 | 'show_info' => true, |
| 1995 | 'show_readmore' => true, |
| 1996 | 'show_author_footer' => false, |
| 1997 | 'timeline_alignment' => 'center', |
| 1998 | 'tag' => '', |
| 1999 | 'reset_query' => true |
| 2000 | ); |
| 2001 | |
| 2002 | // get the shortcode base blog page |
| 2003 | $result = auxin_widget_recent_posts_timeline_callback( $args ); |
| 2004 | } |
| 2005 | |
| 2006 | // if template type is grid |
| 2007 | elseif( strpos( $page_template, 'blog-type-5' ) ){ |
| 2008 | |
| 2009 | $desktop_cnum = 4; |
| 2010 | $tablet_cnum = 3; |
| 2011 | $phone_cnum = 1; |
| 2012 | |
| 2013 | $args = array( |
| 2014 | 'title' => '', |
| 2015 | 'num' => $per_page, |
| 2016 | 'order_by' => 'menu_order date', |
| 2017 | 'order' => 'desc', |
| 2018 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ), |
| 2019 | 'paged' => $paged, |
| 2020 | 'show_media' => true, |
| 2021 | 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ), |
| 2022 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 2023 | 'show_excerpt' => true, |
| 2024 | 'excerpt_len' => '160', |
| 2025 | 'show_title' => true, |
| 2026 | 'show_info' => true, |
| 2027 | 'show_readmore' => true, |
| 2028 | 'show_author_footer' => false, |
| 2029 | 'desktop_cnum' => $desktop_cnum, |
| 2030 | 'tablet_cnum' => $tablet_cnum, |
| 2031 | 'phone_cnum' => $phone_cnum, |
| 2032 | 'preview_mode' => 'grid', |
| 2033 | 'tag' => '', |
| 2034 | 'reset_query' => true |
| 2035 | ); |
| 2036 | |
| 2037 | // get the shortcode base blog page |
| 2038 | $result = auxin_widget_recent_posts_callback( $args ); |
| 2039 | } |
| 2040 | |
| 2041 | return $result; |
| 2042 | } |
| 2043 | |
| 2044 | add_filter( 'auxin_blog_page_template_archive_content', 'auxels_blog_page_templates', 10, 2 ); |
| 2045 | |
| 2046 | |
| 2047 | /*-----------------------------------------------------------------------------------*/ |
| 2048 | /* Add custom blog archive tamplate types |
| 2049 | /*-----------------------------------------------------------------------------------*/ |
| 2050 | |
| 2051 | /** |
| 2052 | * Add custom page templates |
| 2053 | * |
| 2054 | * @param string $result The current custom blog loop template markup |
| 2055 | * @param string $page_template The ID of template type option |
| 2056 | * |
| 2057 | * @return string The markup for current blog archive page |
| 2058 | */ |
| 2059 | function auxels_add_blog_archive_custom_template_layouts( $result, $template_type_id ){ |
| 2060 | |
| 2061 | |
| 2062 | if( 6 == $template_type_id ){ |
| 2063 | |
| 2064 | $args = array( |
| 2065 | 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ), |
| 2066 | 'exclude_custom_post_formats' => 0, |
| 2067 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ), |
| 2068 | 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ), |
| 2069 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 2070 | 'show_media' => true, |
| 2071 | 'show_excerpt' => true, |
| 2072 | 'excerpt_len' => esc_attr( auxin_get_option( 'blog_content_on_listing_length' ) ), |
| 2073 | 'show_info' => true, |
| 2074 | 'author_or_readmore' => 'readmore', |
| 2075 | 'content_layout' => esc_attr( auxin_get_option( 'post_index_column_content_layout', 'full' ) ), |
| 2076 | 'desktop_cnum' => esc_attr( auxin_get_option( 'post_index_column_number' ) ), |
| 2077 | 'tablet_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_tablet' ) ), |
| 2078 | 'phone_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_mobile' ) ), |
| 2079 | 'tag' => '', |
| 2080 | 'extra_classes' => '', |
| 2081 | 'custom_el_id' => '', |
| 2082 | 'reset_query' => false, |
| 2083 | 'use_wp_query' => true, |
| 2084 | ); |
| 2085 | |
| 2086 | $result = auxin_widget_recent_posts_masonry_callback( $args ); |
| 2087 | |
| 2088 | // if template type is tiles |
| 2089 | } elseif( 9 == $template_type_id ){ |
| 2090 | |
| 2091 | $args = array( |
| 2092 | 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ), |
| 2093 | 'exclude_custom_post_formats' => 0, |
| 2094 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ), |
| 2095 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 2096 | 'show_media' => true, |
| 2097 | 'show_excerpt' => true, |
| 2098 | 'excerpt_len' => esc_attr( auxin_get_option( 'blog_content_on_listing_length' ) ), |
| 2099 | 'display_title' => true, |
| 2100 | 'show_info' => true, |
| 2101 | 'author_or_readmore' => 'readmore', |
| 2102 | 'tag' => '', |
| 2103 | 'extra_classes' => '', |
| 2104 | 'custom_el_id' => '', |
| 2105 | 'reset_query' => false, |
| 2106 | 'use_wp_query' => false |
| 2107 | ); |
| 2108 | |
| 2109 | $result = auxin_widget_recent_posts_tiles_callback( $args ); |
| 2110 | |
| 2111 | // if template type is land |
| 2112 | } elseif( 8 == $template_type_id ){ |
| 2113 | |
| 2114 | $args = array( |
| 2115 | 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ), |
| 2116 | 'exclude_custom_post_formats' => 0, |
| 2117 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ), |
| 2118 | 'show_media' => true, |
| 2119 | 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ), |
| 2120 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 2121 | 'show_excerpt' => true, |
| 2122 | 'excerpt_len' => esc_attr( auxin_get_option( 'blog_content_on_listing_length' ) ), |
| 2123 | 'display_title' => true, |
| 2124 | 'show_info' => true, |
| 2125 | 'author_or_readmore' => 'readmore', |
| 2126 | 'image_aspect_ratio' => esc_attr( auxin_get_option( 'post_image_aspect_ratio' ) ), |
| 2127 | 'tag' => '', |
| 2128 | 'extra_classes' => '', |
| 2129 | 'custom_el_id' => '', |
| 2130 | 'reset_query' => false, |
| 2131 | 'use_wp_query' => false |
| 2132 | ); |
| 2133 | |
| 2134 | $result = auxin_widget_recent_posts_land_style_callback( $args ); |
| 2135 | |
| 2136 | // if template type is timeline |
| 2137 | } elseif( 7 == $template_type_id ){ |
| 2138 | |
| 2139 | $args = array( |
| 2140 | 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ), |
| 2141 | 'exclude_custom_post_formats' => 0, |
| 2142 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ), |
| 2143 | 'show_media' => true, |
| 2144 | 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ), |
| 2145 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 2146 | 'show_excerpt' => true, |
| 2147 | 'excerpt_len' => esc_attr( auxin_get_option( 'blog_content_on_listing_length' ) ), |
| 2148 | 'display_title' => true, |
| 2149 | 'show_info' => true, |
| 2150 | 'author_or_readmore' => 'readmore', |
| 2151 | 'image_aspect_ratio' => esc_attr( auxin_get_option( 'post_image_aspect_ratio' ) ), |
| 2152 | 'timeline_alignment' => esc_attr( auxin_get_option( 'post_index_timeline_alignment', 'center' ) ), |
| 2153 | 'tag' => '', |
| 2154 | 'reset_query' => false, |
| 2155 | 'use_wp_query' => false |
| 2156 | ); |
| 2157 | |
| 2158 | $result = auxin_widget_recent_posts_timeline_callback( $args ); |
| 2159 | |
| 2160 | // if template type is grid |
| 2161 | } elseif( 5 == $template_type_id ){ |
| 2162 | |
| 2163 | $args = array( |
| 2164 | 'exclude_without_media' => esc_attr( auxin_get_option( 'exclude_without_media' ) ), |
| 2165 | 'exclude_custom_post_formats' => 0, |
| 2166 | 'exclude_quote_link' => esc_attr( auxin_get_option( 'post_exclude_quote_link_formats', 1 ) ), |
| 2167 | 'show_media' => true, |
| 2168 | 'show_excerpt' => true, |
| 2169 | 'show_info' => esc_attr( auxin_get_option( 'display_post_info', 1 ) ), |
| 2170 | 'post_info_position' => esc_attr( auxin_get_option( 'post_info_position', 'after-title' ) ), |
| 2171 | 'show_date' => true, |
| 2172 | 'display_categories' => esc_attr( auxin_get_option( 'display_post_info_categories', 1 ) ), |
| 2173 | 'display_like' => esc_attr( auxin_get_option( 'show_blog_archive_like_button', 1 ) ), |
| 2174 | 'loadmore_type' => esc_attr( auxin_get_option( 'post_index_loadmore_type', '' ) ), |
| 2175 | 'content_layout' => esc_attr( auxin_get_option( 'post_index_column_content_layout', 'full' ) ), |
| 2176 | 'excerpt_len' => esc_attr( auxin_get_option( 'blog_content_on_listing_length' ) ), |
| 2177 | 'display_title' => true, |
| 2178 | 'author_or_readmore' => 'readmore', |
| 2179 | 'image_aspect_ratio' => esc_attr( auxin_get_option( 'post_image_aspect_ratio' ) ), |
| 2180 | 'desktop_cnum' => esc_attr( auxin_get_option( 'post_index_column_number' ) ), |
| 2181 | 'tablet_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_tablet' ) ), |
| 2182 | 'phone_cnum' => esc_attr( auxin_get_option( 'post_index_column_number_mobile' ) ), |
| 2183 | 'preview_mode' => 'grid', |
| 2184 | 'tag' => '', |
| 2185 | 'reset_query' => false, |
| 2186 | 'use_wp_query' => false |
| 2187 | ); |
| 2188 | |
| 2189 | $result = auxin_widget_recent_posts_callback( $args ); |
| 2190 | } |
| 2191 | |
| 2192 | return $result; |
| 2193 | } |
| 2194 | |
| 2195 | add_filter( 'auxin_blog_archive_custom_template_layouts', 'auxels_add_blog_archive_custom_template_layouts', 10, 2 ); |
| 2196 | |
| 2197 | |
| 2198 | /*-----------------------------------------------------------------------------------*/ |
| 2199 | /* Add Boxed layout to siteorigin row layout types |
| 2200 | /*-----------------------------------------------------------------------------------*/ |
| 2201 | |
| 2202 | function auxin_so_row_style_attributes( $attributes, $style ){ |
| 2203 | |
| 2204 | if ( ! empty( $style['row_stretch'] ) && 'boxed' === $style['row_stretch'] ) { |
| 2205 | if( ( $key = array_search( 'siteorigin-panels-stretch', $attributes['class'] ) ) !== false ) { |
| 2206 | unset( $attributes['class'][ $key ] ); |
| 2207 | } |
| 2208 | $attributes['class'][] = 'aux-fold'; |
| 2209 | } |
| 2210 | |
| 2211 | return $attributes; |
| 2212 | } |
| 2213 | add_filter( 'siteorigin_panels_row_style_attributes', 'auxin_so_row_style_attributes', 12, 2 ); |
| 2214 | |
| 2215 | /*-----------------------------------------------------------------------------------*/ |
| 2216 | /* Add Boxed layout to siteorigin row layout types |
| 2217 | /*-----------------------------------------------------------------------------------*/ |
| 2218 | |
| 2219 | function auxin_so_row_style_fields( $fields ){ |
| 2220 | $fields['row_stretch']['options']['boxed'] = __( 'Boxed', 'auxin-elements' ); |
| 2221 | |
| 2222 | return $fields; |
| 2223 | } |
| 2224 | add_filter( 'siteorigin_panels_row_style_fields', 'auxin_so_row_style_fields', 15 ); |
| 2225 | |
| 2226 | /*-----------------------------------------------------------------------------------*/ |
| 2227 | /* Filtering wp_title to improve seo and letting seo plugins to filter the output too |
| 2228 | /*-----------------------------------------------------------------------------------*/ |
| 2229 | |
| 2230 | if( ! defined( 'WPSEO_VERSION') ){ |
| 2231 | |
| 2232 | function auxin_wp_title($title, $sep, $seplocation) { |
| 2233 | global $page, $paged, $post; |
| 2234 | |
| 2235 | // Don't affect feeds |
| 2236 | if ( is_feed() ) return $title; |
| 2237 | |
| 2238 | // Add the blog name |
| 2239 | if ( 'right' == $seplocation ) |
| 2240 | $title .= get_bloginfo( 'name' ); |
| 2241 | else |
| 2242 | $title = get_bloginfo( 'name' ) . $title; |
| 2243 | |
| 2244 | // Add the blog description for the home/front page |
| 2245 | $site_description = get_bloginfo( 'description', 'display' ); |
| 2246 | if ( $site_description && ( is_home() || is_front_page() ) ) |
| 2247 | $title .= " $sep $site_description"; |
| 2248 | |
| 2249 | // Add a page number if necessary |
| 2250 | if ( $paged >= 2 || $page >= 2 ) |
| 2251 | $title .= " $sep " . sprintf( __( 'Page %s', 'auxin-elements'), max( $paged, $page ) ); |
| 2252 | |
| 2253 | return $title; |
| 2254 | } |
| 2255 | |
| 2256 | add_filter( 'wp_title', 'auxin_wp_title', 10, 3 ); |
| 2257 | } |
| 2258 | |
| 2259 | /*-----------------------------------------------------------------------------------*/ |
| 2260 | /* Make wizard setup ready |
| 2261 | /*-----------------------------------------------------------------------------------*/ |
| 2262 | |
| 2263 | function auxin_theme_setup_wizard() { |
| 2264 | Auxin_Wizard::get_instance(); |
| 2265 | } |
| 2266 | add_action( 'auxin_admin_loaded', 'auxin_theme_setup_wizard' ); |
| 2267 | |
| 2268 | /*-----------------------------------------------------------------------------------*/ |
| 2269 | /* Add new functionality in wp default playlist |
| 2270 | /*-----------------------------------------------------------------------------------*/ |
| 2271 | |
| 2272 | function auxin_underscore_playlist_templates(){ |
| 2273 | ?> |
| 2274 | <script type="text/html" id="tmpl-wp-playlist-current-item"> |
| 2275 | <# if ( data.image ) { #> |
| 2276 | <img src="{{ data.thumb.src }}" alt="" /> |
| 2277 | <# } #> |
| 2278 | <div class="wp-playlist-caption"> |
| 2279 | <span class="wp-playlist-item-meta wp-playlist-item-title"><?php |
| 2280 | /* translators: playlist item title */ |
| 2281 | printf( _x( '“%s”', 'playlist item title' ), '{{ data.title }}' ); |
| 2282 | ?></span> |
| 2283 | <# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #> |
| 2284 | <# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #> |
| 2285 | </div> |
| 2286 | </script> |
| 2287 | <script type="text/html" id="tmpl-wp-playlist-item"> |
| 2288 | <div class="wp-playlist-item"> |
| 2289 | <# |
| 2290 | var isThumbnailExist = data.thumb.src.indexOf("wp-includes/images/media") > 0 ? 'aux-has-no-thubmnail' : ''; |
| 2291 | #> |
| 2292 | <a class="wp-playlist-caption {{ isThumbnailExist }}" href="{{ data.src }}"> |
| 2293 | <# if ( data.image ) { #> |
| 2294 | <img class="wp-playlist-item-artist" src="{{ data.thumb.src }}" alt="{{ data.title }}" /> |
| 2295 | <# } #> |
| 2296 | </a> |
| 2297 | <div class="wp-playlist-item-title" > |
| 2298 | <a href="{{ data.src }}"> |
| 2299 | <h4> |
| 2300 | <# if ( data.caption ) { #> |
| 2301 | <?php |
| 2302 | /* translators: playlist item title */ |
| 2303 | printf( _x( '%s', 'playlist item title' ), '{{{ data.caption }}}' ); |
| 2304 | ?> |
| 2305 | <# } else { #> |
| 2306 | <?php |
| 2307 | /* translators: playlist item title */ |
| 2308 | printf( _x( '%s', 'playlist item title' ), '{{{ data.title }}}' ); |
| 2309 | ?> |
| 2310 | <# } #> |
| 2311 | </h4> |
| 2312 | </a> |
| 2313 | </div> |
| 2314 | </div> |
| 2315 | </script> |
| 2316 | <?php |
| 2317 | } |
| 2318 | |
| 2319 | function auxin_modify_wp_playlist_scripts(){ |
| 2320 | remove_action ( 'wp_footer' , 'wp_underscore_playlist_templates' , 0 ); |
| 2321 | remove_action ( 'admin_footer' , 'wp_underscore_playlist_templates' , 0 ); |
| 2322 | add_action ( 'wp_footer' , 'auxin_underscore_playlist_templates' , 0 ); |
| 2323 | add_action ( 'admin_footer' , 'auxin_underscore_playlist_templates' , 0 ); |
| 2324 | } |
| 2325 | add_action( 'wp_playlist_scripts', 'auxin_modify_wp_playlist_scripts', 15 ); |
| 2326 | |
| 2327 | /*-----------------------------------------------------------------------------------*/ |
| 2328 |