Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
- function your_prefix_function_name( $meta_boxes ) {
- $prefix = 'section_';
- $meta_boxes[] = [
- 'title' => __( 'Sections', 'your-text-domain' ),
- 'id' => 'sections',
- 'post_types' => ['page'],
- 'fields' => [
- [
- 'id' => $prefix . 'group',
- 'type' => 'group',
- 'clone' => true,
- 'sort_clone' => true,
- 'add_button' => __( '+ Add Section', 'your-text-domain' ),
- 'fields' => [
- [
- 'name' => __( 'Section Type', 'your-text-domain' ),
- 'id' => $prefix . 'type',
- 'type' => 'select',
- 'options' => [
- 'hero' => __( 'Hero', 'your-text-domain' ),
- 'cta' => __( 'Call To Action', 'your-text-domain' ),
- 'faq' => __( 'FAQ', 'your-text-domain' ),
- 'wysiwyg' => __( 'WYSIWYG', 'your-text-domain' ),
- ],
- 'placeholder' => __( 'Select section type ', 'your-text-domain' ),
- ],
- [
- 'name' => __( 'Title', 'your-text-domain' ),
- 'id' => $prefix . 'title',
- 'type' => 'text',
- 'visible' => [
- 'when' => [['type', 'contains', 'hero'], ['type', 'contains', 'faq']],
- 'relation' => 'or',
- ],
- ],
- [
- 'name' => __( 'WYSIWYG', 'your-text-domain' ),
- 'id' => $prefix . 'wysiwyg',
- 'type' => 'wysiwyg',
- 'visible' => [
- 'when' => [['type', 'contains', 'wysiwyg']],
- 'relation' => 'or',
- ],
- ],
- [
- 'id' => $prefix . 'faq_items',
- 'type' => 'group',
- 'clone' => true,
- 'sort_clone' => true,
- 'add_button' => __( '+ Add FAQ', 'your-text-domain' ),
- 'fields' => [
- [
- 'name' => __( 'Question', 'your-text-domain' ),
- 'id' => $prefix . 'question',
- 'type' => 'text',
- ],
- [
- 'name' => __( 'Answer', 'your-text-domain' ),
- 'id' => $prefix . 'answer',
- 'type' => 'textarea',
- ],
- ],
- 'visible' => [
- 'when' => [['type', 'contains', 'faq']],
- 'relation' => 'or',
- ],
- ],
- ],
- ],
- ],
- ];
- return $meta_boxes;
- }
- add_filter('use_block_editor_for_post_type', '__return_false', 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement