Created
December 10, 2024 02:24
Create Slider groups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'rwmb_meta_boxes', 'ie_slideshow_shortcode' ); | |
function ie_slideshow_shortcode( $meta_boxes ) { | |
$prefix = 'ie-slider-'; | |
$meta_boxes[] = [ | |
'title' => __( 'IE Slideshow', 'ie-slider' ), | |
'id' => 'ie-slideshow', | |
'closed' => true, | |
'fields' => [ | |
[ | |
'name' => __( 'Sliders', 'ie-slider' ), | |
'id' => $prefix . 'sliders', | |
'type' => 'group', | |
'collapsible' => true, | |
'save_state' => false, | |
'group_title' => __( 'Shortcode: [ie-slider id=\'{#}\']', 'ie-slider' ), | |
'clone' => true, | |
'sort_clone' => false, | |
'clone_default' => false, | |
'clone_as_multiple' => false, | |
'clone_empty_start' => false, | |
'add_button' => __( 'Add More Sliders', 'ie-slider' ), | |
'fields' => [ | |
[ | |
'name' => __( 'Slider', 'ie-slider' ), | |
'id' => $prefix . 'slider', | |
'type' => 'group', | |
'label_description' => __( 'Copy the shortcode above and paste it where you want to see the slider in your content above.', 'ie-slider' ), | |
'collapsible' => true, | |
'save_state' => true, | |
'group_title' => __( 'Slide {#}', 'ie-slider' ), | |
'clone' => true, | |
'sort_clone' => true, | |
'clone_default' => false, | |
'clone_as_multiple' => false, | |
'clone_empty_start' => false, | |
'add_button' => __( 'Add Another Slide', 'ie-slider' ), | |
'fields' => [ | |
[ | |
'name' => __( 'Title', 'ie-slider' ), | |
'id' => $prefix . 'title', | |
'type' => 'text', | |
'required' => false, | |
'disabled' => false, | |
'readonly' => false, | |
'clone' => false, | |
'clone_empty_start' => false, | |
], | |
[ | |
'name' => __( 'Image', 'ie-slider' ), | |
'id' => $prefix . 'image', | |
'type' => 'image_advanced', | |
'max_file_uploads' => 1, | |
'max_status' => false, | |
'force_delete' => false, | |
'required' => false, | |
'clone' => false, | |
'clone_empty_start' => false, | |
], | |
[ | |
'name' => __( 'Caption', 'ie-slider' ), | |
'id' => $prefix . 'caption', | |
'type' => 'text', | |
'required' => false, | |
'disabled' => false, | |
'readonly' => false, | |
'clone' => false, | |
'clone_empty_start' => false, | |
], | |
[ | |
'name' => __( 'Description', 'ie-slider' ), | |
'id' => $prefix . 'description', | |
'type' => 'wysiwyg', | |
'raw' => false, | |
'options' => [ | |
'media_buttons' => false, | |
'textarea_rows' => 6, | |
], | |
'required' => false, | |
'clone' => false, | |
'clone_empty_start' => false, | |
], | |
], | |
], | |
], | |
], | |
], | |
]; | |
return $meta_boxes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment