-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.php
50 lines (49 loc) · 1.38 KB
/
example.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
//CMB2 Init for custom post type "produk"
add_action( 'cmb2_init', 'produk_register_metabox' );
function produk_register_metabox() {
$cmb = new_cmb2_box( array(
'id' => 'produk_metabox',
'title' => 'Detail Produk',
'object_types' => array( 'produk'),
) );
$cmb->add_field( array(
'name' => 'Nama Produk',
'desc' => '',
'id' => 'post_title',
'type' => 'text',
) );
$cmb->add_field( array(
'name' => 'Harga',
'desc' => 'Tanpa Rp',
'id' => 'harga',
'type' => 'text',
) );
$cmb->add_field( array(
'name' => 'Deskripsi',
'desc' => '',
'id' => 'post_content',
'type' => 'wysiwyg',
'options' => array(
'media_buttons' => false,
),
) );
$cmb->add_field( array(
'name' => 'Foto',
'desc' => '',
'id' => 'post_thumbnail',
'type' => 'file',
) );
$cmb->add_field( array(
'name' => 'Kategori',
'desc' => 'Description Goes Here',
'id' => 'kategori-produk',
'taxonomy' => 'kategori-produk',
'type' => 'taxonomy_select',
'remove_default' => 'true',
'query_args' => array(
// 'orderby' => 'slug',
'hide_empty' => false,
),
) );
}