| @@ -1,0 +1,100 @@ | ||
| 1 | +# CMB2 Tabs | |
| 2 | + | |
| 3 | +Tabs for [CMB2](https://github.com/WebDevStudios/CMB2). | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | +## How it works? | |
| 8 | + | |
| 9 | +This plugin adds new parameters to CMB2 boxes: | |
| 10 | + | |
| 11 | +* vertical_tabs (bool) | |
| 12 | +* tabs (array) | |
| 13 | + | |
| 14 | +## Example | |
| 15 | +```php | |
| 16 | +add_action( 'cmb2_admin_init', 'cmb2_sample_metabox' ); | |
| 17 | +function cmb2_sample_metabox() { | |
| 18 | + | |
| 19 | + $prefix = 'your_prefix_demo_'; | |
| 20 | + | |
| 21 | + $cmb_demo = new_cmb2_box( array( | |
| 22 | + 'id' => $prefix . 'metabox', | |
| 23 | + 'title' => __( 'Test Metabox', 'cmb2' ), | |
| 24 | + 'object_types' => array( 'page', 'post' ), // Post type | |
| 25 | + 'vertical_tabs' => true, // Set vertical tabs, default false | |
| 26 | + 'tabs' => array( | |
| 27 | + array( | |
| 28 | + 'id' => 'tab-1', | |
| 29 | + 'icon' => 'dashicons-admin-site', | |
| 30 | + 'title' => 'Tab 1', | |
| 31 | + 'fields' => array( | |
| 32 | + $prefix . '_field_1', | |
| 33 | + $prefix . '_field_2', | |
| 34 | + ), | |
| 35 | + ), | |
| 36 | + array( | |
| 37 | + 'id' => 'tab-2', | |
| 38 | + 'icon' => 'dashicons-align-left', | |
| 39 | + 'title' => 'Tab 2', | |
| 40 | + 'fields' => array( | |
| 41 | + $prefix . '_field_3', | |
| 42 | + $prefix . '_field_4', | |
| 43 | + ), | |
| 44 | + ), | |
| 45 | + ) | |
| 46 | + ) ); | |
| 47 | + | |
| 48 | + $cmb_demo->add_field( array( | |
| 49 | + 'name' => __( 'Test field 1', 'cmb2' ), | |
| 50 | + 'id' => $prefix . '_field_1', | |
| 51 | + 'type' => 'text', | |
| 52 | + ) ); | |
| 53 | + | |
| 54 | + $cmb_demo->add_field( array( | |
| 55 | + 'name' => __( 'Test field 2', 'cmb2' ), | |
| 56 | + 'id' => $prefix . '_field_2', | |
| 57 | + 'type' => 'text', | |
| 58 | + ) ); | |
| 59 | + | |
| 60 | + $cmb_demo->add_field( array( | |
| 61 | + 'name' => __( 'Test field 3', 'cmb2' ), | |
| 62 | + 'id' => $prefix . '_field_3', | |
| 63 | + 'type' => 'text', | |
| 64 | + ) ); | |
| 65 | + | |
| 66 | + $cmb_demo->add_field( array( | |
| 67 | + 'name' => __( 'Test field 4', 'cmb2' ), | |
| 68 | + 'id' => $prefix . '_field_4', | |
| 69 | + 'type' => 'text', | |
| 70 | + ) ); | |
| 71 | + | |
| 72 | +} | |
| 73 | +``` | |
| 74 | + | |
| 75 | +## Changelog | |
| 76 | + | |
| 77 | +### 1.0.5 | |
| 78 | + | |
| 79 | +* Added the attribute tabs_speed. | |
| 80 | + | |
| 81 | +### 1.0.4 | |
| 82 | + | |
| 83 | +* Ensure that all tab parameters has been passed correctly. | |
| 84 | + | |
| 85 | +### 1.0.3 | |
| 86 | + | |
| 87 | +* Added support for dark mode. | |
| 88 | +* Fixed tab display on widgets screen. | |
| 89 | + | |
| 90 | +### 1.0.2 | |
| 91 | + | |
| 92 | +* Fixed add group row selector. | |
| 93 | + | |
| 94 | +### 1.0.1 | |
| 95 | + | |
| 96 | +* Added cmb2-tab-ignore utility. | |
| 97 | + | |
| 98 | +### 1.0.0 | |
| 99 | + | |
| 100 | +* Initial commit. | |