Support Forum
Support › Meta Box Group › Meta box group inside meta box group
Hi there, I'd like to make a restaurant menu with metabox group.
This the first big group clone with one single category title
Title Category - ie. Salads
And this items clone also.
Title Salad - ie. Ceaser Salad
Description Salad - ie. Lettuce, rockets ...
Price - 9.99
Title Salad 2 - ie. Tomato Salad
Description Salad - ie. Lettuce, rockets ...
Price - 8.99
$meta_boxes[] = array(
'title' => __( 'the tile' ),
'pages' => array( 'page' ),
'context' => 'normal',
'priority' => 'high',
'show' => array(
'relation' => 'OR',
'template' => array( 'page-menu.php' ),
),
'fields' => array(
array(
'id' => $prefix . 'menu_cat_group',
'name' => 'Group',
'desc' => 'Menu Categorie',
'type' => 'group', //Here the big group clone
'clone' => true,
'fields' => array(
array(
'name' => 'Menu category title',
'id' => $prefix . 'menu_cat_title',
'desc' => 'Create a menu mother category',//one main category title Salads
'type' => 'text',
'columns'=> 12,
'clone' => false,
),
array(
'id' => $prefix . 'menu_cat_desc',
'type' => 'group', //The second clone group
'clone' => true,
'fields' => array(
array(
'name' => 'Item title', //ie. Ceaser Salad
'id' => $prefix . 'menu_item_description',
'desc' => 'Item title here',
'columns'=> 4,
'type' => 'text',
),
array(
'name' => 'Description',
'id' => $prefix . 'menu_item_description',
'desc' => 'Describe your item here',
'columns'=> 4,
'type' => 'textarea',
),
array(
'name' => 'Price',
'id' => $prefix . 'menu_item_price',
'desc' => 'Display the price here',
'columns'=> 4,
'type' => 'text',
),
),
),
),
),
),
);
Hi marcogonzaga, unfortunately the nested group feature is not supported at the moment :(. But I think you can solve your problem with:
- Create a new custom post type "menu"
- Create meta box for "menu", to add items (can be clone)
- In "page", use field "post" to add menu to page
Thank's Ahn Tran!
I was thinking in this option too.
All the best.