-
Notifications
You must be signed in to change notification settings - Fork 1
/
tutty-metabox-fields.php
126 lines (122 loc) · 3.91 KB
/
tutty-metabox-fields.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php if( ! defined( 'ABSPATH' ) ) { die; }
$fields = array();
$fields[] = array(
'id' => 'post_settings',
'title' => 'Post Settings',
'priority' => 'high',
'fields' => array(
array(
'id' => 'number_fields',
'title' => 'Number Field',
'type' => 'number',
),
array(
'id' => 'text_field',
'title' => 'Text Field',
'type' => 'text',
),
array(
'id' => 'text_field_default',
'title' => 'Text Field with Default',
'default' => 'This is a default value.',
'type' => 'text',
),
array(
'id' => 'text_field_maxlength',
'title' => 'Text Field maxlength',
'type' => 'text',
'attr' => array(
'placeholder' => 'Placeholder value...',
'maxlength' => 5
),
),
array(
'id' => 'text_field_readonly',
'default' => 'This readonly text field.',
'title' => 'Text Field Readonly',
'type' => 'text',
'attr' => array(
'readonly' => 'only-key'
),
),
array(
'id' => 'textarea_field',
'title' => 'Textarea Field',
'type' => 'textarea',
'sanitize' => false
),
array(
'id' => 'category_select',
'desc' => 'This is a category select box.',
'title' => 'Category Select',
'type' => 'select',
'options' => 'categories'
),
array(
'id' => 'category_select_multiple',
'desc' => 'This is a multiple category select box.',
'title' => 'Multiple Select',
'type' => 'select',
'attr' => array(
'multiple' => 'only-key',
'style' => 'width:200px'
),
'options' => 'categories'
),
array(
'id' => 'page_select',
'desc' => 'This is a page select box.',
'title' => 'Page Select',
'type' => 'select',
'options' => 'pages'
),
array(
'id' => 'custom_select',
'desc' => 'This is a custom select box with default option.',
'title' => 'Custom Select',
'type' => 'select',
'default' => 'turkish',
'options' => array(
'english' => 'English',
'turkish' => 'Türkçe',
'german' => 'Deutsch',
),
),
array(
'type' => 'heading',
'title' => 'Lorem Ipsum',
'content' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.'
),
array(
'id' => 'upload_field',
'type' => 'upload',
'title' => 'Upload Field',
),
array(
'id' => 'page_checkbox',
'type' => 'checkbox',
'title' => 'Page Checkbox',
'options' => 'pages',
),
array(
'id' => 'custom_checkbox',
'type' => 'checkbox',
'title' => 'Custom Checkbox',
'options' => [ 'English', 'Türkçe', 'Deutsch' ],
'default' => [ 1,2 ]
),
array(
'id' => 'switcher_field',
'type' => 'switcher',
'title' => 'Switcher Field',
),
array(
'id' => 'switcher_field_default',
'desc' => 'This is a switcher field with default value.',
'type' => 'switcher',
'title' => 'Switcher Field',
'default' => 'on'
),
)
);
new Tutty_MetaBox( $fields );