Support Forum
Support › MB Custom Table › Date, media and repeater sectionsResolved
Hello,
I set up a .php for MB custom Table. The post information is generated using forms in Elementor with e-addons. As beginner, I do not understand all necessary steps. Maybe you have a tip on the following questions:
register_activation_hook( <strong>FILE</strong>, 'prefix_create_table' );
function prefix_create_table() {
if ( ! class_exists( 'MB_Custom_Table_API' ) ) {
return;
}
MB_Custom_Table_API::create( 'my_custom_table', array(
'story_basic_category' => 'TEXT NOT NULL',
'story_basic_category_date' => 'VARCHAR(20) NOT NULL',
'story_basic_category_experience' => 'TEXT NOT NULL',
'story_basic_question' => 'TEXT NOT NULL',
'story_basic_category_target_group' => 'TEXT NOT NULL',
'story_basic_repeater_paragraph_heading' => 'TEXT NOT NULL',
'story_basic_repeater_paragraph_text' => 'TEXT NOT NULL',
'story_basic_repeater_paragraph_media' => 'TEXT NOT NULL',
);
}
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array(
'title' => 'Meta Box Title',
'storage_type' => 'custom_table', // Important
'table' => 'my_custom_table', // Your custom table name
'fields' => array(
array(
'id' => 'story_basic_category',
'type' => 'text',
'name' => 'Story Basic Category',
),
array(
'id' => 'story_basic_category_date',
'type' => 'date',
'name' => 'Story Basic Category Date',
),
array(
'id' => 'story_basic_category_experience',
'type' => 'text',
'name' => 'Story Basic Category Experience',
),
array(
'id' => 'story_basic_question',
'type' => 'text',
'name' => 'Story Basic Question',
),
array(
'id' => 'story_basic_category_target_group',
'type' => 'text',
'name' => 'Story Basic Category Target Group',
),
array(
'id' => 'story_basic_repeater_paragraph_heading',
'type' => 'text',
'name' => 'Story Basic Repeater Paragraph Heading',
),
array(
'id' => 'story_basic_repeater_paragraph_text',
'type' => 'text',
'name' => 'Story Basic Repeater Paragraph Text',
),
array(
'id' => 'story_basic_repeater_paragraph_media',
'type' => 'file',
'name' => 'Story Basic Repeater Paragraph Media',
),
),
);
return $meta_boxes;
}
Hi,
DATE
, please read more here https://www.mysqltutorial.org/mysql-data-types.aspx
'clone' => true
to the field that you want to repeat, please read more here https://docs.metabox.io/cloning-fields/
array(
'id' => 'story_basic_repeater_paragraph_text',
'type' => 'text',
'name' => 'Story Basic Repeater Paragraph Text',
'clone' => true,
),
Thank you for your detailed answer 🙂