Meta box group inside meta box group

Support MB Group Meta box group inside meta box group

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #799
    marcogonzagamarcogonzaga
    Participant

    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',
    							),
    							
    						),
    					),
    				),
    			),
    		),
    	);
    #806
    Anh TranAnh Tran
    Keymaster

    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

    #811
    marcogonzagamarcogonzaga
    Participant

    Thank's Ahn Tran!

    I was thinking in this option too.

    All the best.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Meta box group inside meta box group’ is closed to new replies.