0
|
1 |
<?php |
|
2 |
/** |
|
3 |
* Initialize the meta boxes. |
|
4 |
*/ |
|
5 |
add_action( 'admin_init', '_custom_meta_boxes' ); |
|
6 |
|
|
7 |
/** |
|
8 |
* Meta Boxes demo code. |
|
9 |
* |
|
10 |
* You can find all the available option types |
|
11 |
* in demo-theme-options.php. |
|
12 |
* |
|
13 |
* @return void |
|
14 |
* |
|
15 |
* @access private |
|
16 |
* @since 2.0 |
|
17 |
*/ |
|
18 |
function _custom_meta_boxes() { |
|
19 |
|
|
20 |
/** |
|
21 |
* Create a custom meta boxes array that we pass to |
|
22 |
* the OptionTree Meta Box API Class. |
|
23 |
*/ |
|
24 |
$my_meta_box = array( |
|
25 |
'id' => 'my_meta_box', |
|
26 |
'title' => 'Demo Meta Box', |
|
27 |
'desc' => '', |
|
28 |
'pages' => array( 'post' ), |
|
29 |
'context' => 'normal', |
|
30 |
'priority' => 'high', |
|
31 |
'fields' => array( |
|
32 |
array( |
|
33 |
'label' => 'Background', |
|
34 |
'id' => 'my_background', |
|
35 |
'type' => 'background', |
|
36 |
'desc' => 'BlahLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', |
|
37 |
'std' => '', |
|
38 |
'rows' => '', |
|
39 |
'post_type' => '', |
|
40 |
'taxonomy' => '', |
|
41 |
'class' => '' |
|
42 |
), |
|
43 |
array( |
|
44 |
'label' => 'Category Checkbox', |
|
45 |
'id' => 'my_category_checkbox', |
|
46 |
'type' => 'category-checkbox', |
|
47 |
'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', |
|
48 |
'std' => '', |
|
49 |
'rows' => '', |
|
50 |
'post_type' => '', |
|
51 |
'taxonomy' => '', |
|
52 |
'class' => '' |
|
53 |
) |
|
54 |
) |
|
55 |
); |
|
56 |
|
|
57 |
/** |
|
58 |
* Register our meta boxes using the |
|
59 |
* ot_register_meta_box() function. |
|
60 |
*/ |
|
61 |
ot_register_meta_box( $my_meta_box ); |
|
62 |
|
|
63 |
} |