Created
April 17, 2017 04:19
-
-
Save rilwis/d6635c18cca81aaa4a593d4c178b456b to your computer and use it in GitHub Desktop.
Hierarchical select/checkbox_list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) { | |
$meta_boxes[] = array( | |
'title' => 'Test', | |
'fields' => array( | |
array( | |
'type' => 'select_tree', // or checkbox_list | |
'id' => 'cb', | |
'name' => 'Hierarchical checkboxes', | |
'options' => array( | |
array( 'value' => 'value1', 'label' => 'label 1' ), | |
array( 'value' => 'value2', 'label' => 'label 2' ), | |
array( 'value' => 'sub1', 'label' => 'Sub 1', 'parent' => 'value1' ), | |
array( 'value' => 'sub2', 'label' => 'Sub 2', 'parent' => 'value1' ), | |
), | |
'flatten' => false, | |
), | |
), | |
); | |
return $meta_boxes; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment