Meta box group inside meta box group
- This topic has 2 replies, 2 voices, and was last updated 9 years, 12 months ago by
marcogonzaga.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
April 23, 2015 at 6:06 AM #799
marcogonzaga
ParticipantHi 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. SaladsAnd this items clone also.
Title Salad - ie. Ceaser Salad
Description Salad - ie. Lettuce, rockets ...
Price - 9.99Title 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', ), ), ), ), ), ), );
April 24, 2015 at 8:36 AM #806Anh Tran
KeymasterHi 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 pageApril 24, 2015 at 8:34 PM #811marcogonzaga
ParticipantThank's Ahn Tran!
I was thinking in this option too.
All the best.
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- The topic ‘Meta box group inside meta box group’ is closed to new replies.