-
Notifications
You must be signed in to change notification settings - Fork 1
/
metabox.php
executable file
·35 lines (26 loc) · 985 Bytes
/
metabox.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/** Business Category **/
add_action( 'cmb2_admin_init', 'stanleywp_metaboxes' );
function stanleywp_metaboxes() {
// Start with an underscore to hide fields from custom fields list
$prefix = '_stanleywp_';
/**
* Initiate the metabox
*/
$cmb = new_cmb2_box( array(
'id' => 'post_metabox',
'title' => __( 'Post Settings', 'stanleywp' ),
'object_types' => array( 'post', ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
// 'cmb_styles' => false, // false to disable the CMB stylesheet
// 'closed' => true, // Keep the metabox closed by default
) );
// Regular text field
$cmb->add_field( array(
'name' => __( 'Full Width Featured Image', 'stanleywp' ),
'id' => $prefix . 'full_featured',
'type' => 'checkbox',
) );
}