Metaboxes

Code

Function
Example
1
wponion_admin_bar(
2
array($title, $href, $id, $meta, $parent, $group, $submenus)
3
);
Copied!
1
add_action('wponion/loaded', function() {
2
3
function this_wpodoc_metabox() {
4
5
$builder = wponion_builder();
6
7
$this_title = str_replace('_', ' ', strtoupper(__FUNCTION__));
8
9
$section1 = $builder->container( '1234567', $this_title, 'dashicons dashicons-admin-generic' );
10
$section1->text( 'text', 'Text' );
11
$section1->textarea( 'textarea', 'Textarea' );
12
$section1->switcher( 'switcher', 'switcher' );
13
14
$section2 = $builder->container( 'section2', __( 'Section 2' ) );
15
$section2->color_picker( 'color_picker', 'Color Picker' );
16
17
$page = $builder->container( 'page', __( 'Nested Sections' ), 'dashicons dashicons-admin-generic' );
18
$s1 = $page->container( 'section1', 'Section 1', 'dashicons dashicons-admin-generic' );
19
$s1->text( 'page_s1_text', 'Text' );
20
$s1->textarea( 'page_s1_textarea', 'Textarea' );
21
$s1->switcher( 'page_s1_switcher', 'switcher' );
22
23
$s2 = $page->container( 'section2', 'Section 2', 'dashicons dashicons-admin-generic' );
24
$s2->color_picker( 'page_s1_color_picker', 'Color Picker' );
25
$s2->icon_picker( 'page_s1_icon_picker', 'Icon Picker' );
26
27
return $builder;
28
29
}
30
31
$colors = array(
32
'light',
33
'blue',
34
'coffee',
35
'ectoplasm',
36
'midnight',
37
'ocean',
38
'sunrise',
39
'#e14d43',
40
'#e16443',
41
'#43afe1',
42
'#436ce1',
43
'#8443e1',
44
'#e14397',
45
);
46
47
$metabox_settings = array(
48
'option_name' => 'this_wpodoc_metabox',
49
'metabox_title' => __( 'Custom Post/Page Optionss' ),
50
'metabox_id' => 'this_wpodoc_metabox',
51
'screens' => array( 'post', 'page' ),
52
'ajax' => true,
53
'color_scheme' => $colors,
54
'theme' => 'wp_modern',
55
);
56
57
wponion_metabox($metabox_settings, 'this_wpodoc_metabox');
58
59
});
Copied!

Output

Tutorial

Project Usage

Notes

There are currently no extra notes for this operation.
Last modified 1yr ago
Export as PDF
Copy link