/flexible-content-field-by-meta-box.php
Forked from kutoi94/flexible-by-meta-box
Last active Jun 9, 2019
Create ACF Flexible Field with Meta Box Plugin
<?php | |
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); | |
function your_prefix_register_meta_boxes( $meta_boxes ) { | |
$meta_boxes[] = array ( | |
'title' => 'Flexible Field Example', | |
'post_types' => 'page', | |
'fields' => array( | |
array ( | |
'id' => 'sections', | |
'type' => 'group', | |
'name' => 'Sections', | |
'fields' => array( | |
array ( | |
'id' => 'select', | |
'name' => 'Select', | |
'type' => 'select', | |
'placeholder' => 'Select an Item', | |
'options' => array( | |
'Services' => 'Services', | |
'Testimonials' => 'Testimonials', | |
'Facts' => 'Facts', | |
), | |
), | |
array ( | |
'id' => 'services', | |
'type' => 'group', | |
'name' => 'Services', | |
'fields' => array( | |
array ( | |
'id' => 'secvices_box', | |
'type' => 'group', | |
'name' => 'Secvices Box', | |
'fields' => array( | |
array ( | |
'id' => 'image', | |
'type' => 'single_image', | |
'name' => 'Icon services', | |
'desc' => 'Transparent background', | |
), | |
array ( | |
'id' => 'description', | |
'type' => 'textarea', | |
'name' => 'Description', | |
), | |
), | |
'clone' => true, | |
'collapsible' => true, | |
'group_title' => 'Secvices Box', | |
), | |
), | |
'default_state' => 'expanded', | |
'collapsible' => true, | |
'save_state' => true, | |
'group_title' => 'Services Section', | |
'visible' => array( 'select', 'Services' ), | |
), | |
array ( | |
'id' => 'testimonials', | |
'type' => 'group', | |
'name' => 'Testimonials', | |
'fields' => array( | |
array ( | |
'id' => 'testimonials_box', | |
'type' => 'group', | |
'name' => 'Testimonials Box', | |
'fields' => array( | |
array ( | |
'id' => 'image_upload_2', | |
'type' => 'image_upload', | |
'name' => 'Image profile', | |
'max_status' => false, | |
'max_file_uploads' => 1, | |
'image_size' => 'thumbnail', | |
), | |
array ( | |
'id' => 'Content', | |
'name' => 'Content', | |
'type' => 'wysiwyg', | |
), | |
), | |
), | |
), | |
'collapsible' => true, | |
'group_title' => 'Testimonials Section', | |
'visible' => array( 'select', 'Testimonials' ), | |
), | |
array ( | |
'id' => 'facts', | |
'type' => 'group', | |
'name' => 'Facts', | |
'fields' => array( | |
array ( | |
'id' => 'title', | |
'type' => 'text', | |
'name' => 'Title Fact', | |
), | |
array ( | |
'id' => 'textarea_2', | |
'type' => 'textarea', | |
'name' => 'Description Fact', | |
), | |
array ( | |
'id' => 'group_2', | |
'type' => 'group', | |
'name' => 'Fact Box', | |
'fields' => array( | |
array ( | |
'id' => 'text_2', | |
'type' => 'text', | |
'name' => 'Title', | |
), | |
array ( | |
'id' => 'number_2', | |
'type' => 'number', | |
'name' => 'Amount', | |
), | |
), | |
), | |
), | |
'collapsible' => true, | |
'group_title' => 'Facts Section', | |
'visible' => array( 'select', 'Facts' ), | |
), | |
), | |
'clone' => true, | |
'collapsible' => true, | |
'save_state' => true, | |
'group_title' => 'Choose which section you want', | |
), | |
), | |
); | |
return $meta_boxes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment