|
|
@@ -4,7 +4,7 @@
|
|
4
|
4
|
* Defining our HERO, and Name override fields
|
|
5
|
5
|
*/
|
|
6
|
6
|
function sanitize_hero_urls( $value, $field_args, $field ) {
|
|
7
|
|
- $encoded = wp_json_encode( array( 'url' => $value ), true );
|
|
|
7
|
+ $encoded = wp_json_encode( ['url' => $value], true );
|
|
8
|
8
|
return $encoded;
|
|
9
|
9
|
}
|
|
10
|
10
|
|
|
|
@@ -20,7 +20,7 @@
|
|
20
|
20
|
<div class="custom-field-row">
|
|
21
|
21
|
<p>
|
|
22
|
22
|
<label for="<?php echo $id; ?>"><?php echo $label; ?></label>
|
|
23
|
|
- <input style="width: 100%;" id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>"
|
|
|
23
|
+ <input style="width: 100%;" id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>"
|
|
24
|
24
|
value="<?php echo $decoded['url']; ?>"/>
|
|
25
|
25
|
</p>
|
|
26
|
26
|
<p class="description"><?php echo $description; ?></p>
|
|
|
@@ -36,22 +36,22 @@
|
|
36
|
36
|
/**
|
|
37
|
37
|
* Initiate the metabox
|
|
38
|
38
|
*/
|
|
39
|
|
- $cmb = new_cmb2_box( array(
|
|
40
|
|
- 'id' => 'hero_metabox',
|
|
41
|
|
- 'title' => __( 'Hero', 'cmb2' ),
|
|
42
|
|
- 'object_types' => array( 'artist', 'event', 'exhibition' ), // Post type
|
|
43
|
|
- 'show_in_rest' => WP_REST_Server::READABLE
|
|
44
|
|
- ) );
|
|
|
39
|
+ $cmb = new_cmb2_box([
|
|
|
40
|
+ 'id' => 'hero_metabox',
|
|
|
41
|
+ 'title' => __( 'Hero', 'cmb2' ),
|
|
|
42
|
+ 'object_types' => ['artist', 'episode', 'event', 'exhibition'], // Post type
|
|
|
43
|
+ 'show_in_rest' => WP_REST_Server::READABLE
|
|
|
44
|
+ ]);
|
|
45
|
45
|
|
|
46
|
46
|
// URL text field
|
|
47
|
|
- $cmb->add_field( array(
|
|
48
|
|
- 'name' => __( 'YouTube URL', 'cmb2' ),
|
|
49
|
|
- 'desc' => __( 'Video for the hero section to display', 'cmb2' ),
|
|
50
|
|
- 'id' => 'hero_header',
|
|
51
|
|
- 'type' => 'text',
|
|
52
|
|
- 'sanitization_cb' => 'sanitize_hero_urls',
|
|
53
|
|
- 'render_row_cb' => 'cmb_hero_render_row_cb'
|
|
54
|
|
- ) );
|
|
|
47
|
+ $cmb->add_field([
|
|
|
48
|
+ 'name' => __( 'YouTube URL', 'cmb2' ),
|
|
|
49
|
+ 'desc' => __( 'Video for the hero section to display', 'cmb2' ),
|
|
|
50
|
+ 'id' => 'hero_header',
|
|
|
51
|
+ 'type' => 'text',
|
|
|
52
|
+ 'sanitization_cb' => 'sanitize_hero_urls',
|
|
|
53
|
+ 'render_row_cb' => 'cmb_hero_render_row_cb'
|
|
|
54
|
+ ]);
|
|
55
|
55
|
}
|
|
56
|
56
|
|
|
57
|
57
|
function cmb2_sticky_metaboxes() {
|
|
|
@@ -59,76 +59,91 @@
|
|
59
|
59
|
/**
|
|
60
|
60
|
* Initiate the metabox
|
|
61
|
61
|
*/
|
|
62
|
|
- $cmb = new_cmb2_box( array(
|
|
63
|
|
- 'id' => 'stick_metabox',
|
|
64
|
|
- 'title' => __( 'Sticky Post', 'cmb2' ),
|
|
65
|
|
- 'object_types' => array( 'artist', 'event', 'exhibition', 'episode', 'page', 'post' ), // Post type
|
|
66
|
|
- 'show_in_rest' => WP_REST_Server::READABLE
|
|
67
|
|
- ) );
|
|
|
62
|
+ $cmb = new_cmb2_box([
|
|
|
63
|
+ 'id' => 'stick_metabox',
|
|
|
64
|
+ 'title' => __( 'Sticky Post', 'cmb2' ),
|
|
|
65
|
+ 'object_types' => ['artist', 'event', 'exhibition', 'episode', 'page', 'post'], // Post type
|
|
|
66
|
+ 'show_in_rest' => WP_REST_Server::READABLE
|
|
|
67
|
+ ]);
|
|
68
|
68
|
|
|
69
|
69
|
// URL text field
|
|
70
|
|
- $cmb->add_field( array(
|
|
71
|
|
- 'name' => __( 'Make sticky?', 'cmb2' ),
|
|
72
|
|
- 'desc' => __( 'Check to stick this post on the homepage', 'cmb2' ),
|
|
73
|
|
- 'id' => 'is_sticky',
|
|
74
|
|
- 'type' => 'checkbox'
|
|
75
|
|
- ) );
|
|
|
70
|
+ $cmb->add_field([
|
|
|
71
|
+ 'name' => __( 'Make sticky?', 'cmb2' ),
|
|
|
72
|
+ 'desc' => __( 'Check to stick this post on the homepage', 'cmb2' ),
|
|
|
73
|
+ 'id' => 'is_sticky',
|
|
|
74
|
+ 'type' => 'checkbox'
|
|
|
75
|
+ ]);
|
|
76
|
76
|
}
|
|
77
|
77
|
|
|
78
|
78
|
function cmb2_artist_sort_metaboxes() {
|
|
79
|
|
- $cmb = new_cmb2_box( array(
|
|
80
|
|
- 'id' => 'artist_sort_metabox',
|
|
81
|
|
- 'title' => __( 'Name Override', 'cmb2' ),
|
|
82
|
|
- 'object_types' => array( 'artist' ),
|
|
83
|
|
- 'show_in_rest' => WP_REST_Server::READABLE
|
|
84
|
|
- ) );
|
|
85
|
|
- $cmb->add_field( array(
|
|
86
|
|
- 'name' => __( 'Alternate Name', 'cmb2' ),
|
|
87
|
|
- 'desc' => __( 'Name to use for alphabetical sorting', 'cmb2' ),
|
|
88
|
|
- 'id' => 'artist-sort-name',
|
|
89
|
|
- 'type' => 'text'
|
|
90
|
|
- ) );
|
|
|
79
|
+ $cmb = new_cmb2_box([
|
|
|
80
|
+ 'id' => 'artist_sort_metabox',
|
|
|
81
|
+ 'title' => __( 'Name Override', 'cmb2' ),
|
|
|
82
|
+ 'object_types' => ['artist'],
|
|
|
83
|
+ 'show_in_rest' => WP_REST_Server::READABLE
|
|
|
84
|
+ ]);
|
|
|
85
|
+ $cmb->add_field([
|
|
|
86
|
+ 'name' => __( 'Alternate Name', 'cmb2' ),
|
|
|
87
|
+ 'desc' => __( 'Name to use for alphabetical sorting', 'cmb2' ),
|
|
|
88
|
+ 'id' => 'artist-sort-name',
|
|
|
89
|
+ 'type' => 'text'
|
|
|
90
|
+ ]);
|
|
|
91
|
+ }
|
|
|
92
|
+
|
|
|
93
|
+ function cmb2_episode_credits_metaboxes() {
|
|
|
94
|
+ $cmb = new_cmb2_box([
|
|
|
95
|
+ 'id' => 'meta_credits',
|
|
|
96
|
+ 'title' => __( 'Credits', 'cmb2' ),
|
|
|
97
|
+ 'object_types' => ['episode'],
|
|
|
98
|
+ 'show_in_rest' => WP_REST_Server::READABLE
|
|
|
99
|
+ ]);
|
|
|
100
|
+ $cmb->add_field([
|
|
|
101
|
+ 'name' => __( 'Episode Credits', 'cmb2' ),
|
|
|
102
|
+ 'desc' => __( 'HTML content for Episode credits', 'cmb2' ),
|
|
|
103
|
+ 'id' => 'credits',
|
|
|
104
|
+ 'type' => 'wysiwyg'
|
|
|
105
|
+ ]);
|
|
91
|
106
|
}
|
|
92
|
107
|
|
|
93
|
108
|
function cmb2_event_date_metaboxes() {
|
|
94
|
|
- $cmb = new_cmb2_box( array(
|
|
|
109
|
+ $cmb = new_cmb2_box([
|
|
95
|
110
|
'id' => 'event-date',
|
|
96
|
111
|
'title' => __( 'Date and Time', 'cmb2' ),
|
|
97
|
|
- 'object_types' => array( 'event' ), // Post type
|
|
|
112
|
+ 'object_types' => ['event'], // Post type
|
|
98
|
113
|
'show_in_rest' => WP_REST_Server::READABLE
|
|
99
|
|
- ) );
|
|
100
|
|
- $cmb->add_field( array(
|
|
|
114
|
+ ]);
|
|
|
115
|
+ $cmb->add_field([
|
|
101
|
116
|
'name' => __( 'Start', 'cmb2' ),
|
|
102
|
117
|
'desc' => __( 'The date and time of your event', 'cmb2' ),
|
|
103
|
118
|
'id' => 'event-start-time',
|
|
104
|
119
|
'type' => 'text_datetime_timestamp'
|
|
105
|
|
- ) );
|
|
106
|
|
- $cmb->add_field( array(
|
|
|
120
|
+ ]);
|
|
|
121
|
+ $cmb->add_field([
|
|
107
|
122
|
'name' => __( 'End', 'cmb2' ),
|
|
108
|
123
|
'desc' => __( 'The date and time your event ends', 'cmb2' ),
|
|
109
|
124
|
'id' => 'event-end-time',
|
|
110
|
125
|
'type' => 'text_datetime_timestamp'
|
|
111
|
|
- ) );
|
|
|
126
|
+ ]);
|
|
112
|
127
|
}
|
|
113
|
128
|
|
|
114
|
129
|
function cmb2_exhibition_date_metaboxes() {
|
|
115
|
|
- $cmb = new_cmb2_box( array(
|
|
|
130
|
+ $cmb = new_cmb2_box([
|
|
116
|
131
|
'id' => 'exhibit-date',
|
|
117
|
132
|
'title' => __( 'Date', 'cmb2' ),
|
|
118
|
|
- 'object_types' => array( 'exhibition' ), // Post type
|
|
|
133
|
+ 'object_types' => ['exhibition'], // Post type
|
|
119
|
134
|
'show_in_rest' => WP_REST_Server::READABLE
|
|
120
|
|
- ) );
|
|
121
|
|
- $cmb->add_field( array(
|
|
|
135
|
+ ]);
|
|
|
136
|
+ $cmb->add_field([
|
|
122
|
137
|
'name' => __( 'Start Date', 'cmb2' ),
|
|
123
|
138
|
'desc' => __( 'The date of your exhibition', 'cmb2' ),
|
|
124
|
139
|
'id' => 'exhibit-start-date',
|
|
125
|
140
|
'type' => 'text_date_timestamp'
|
|
126
|
|
- ) );
|
|
127
|
|
- $cmb->add_field( array(
|
|
|
141
|
+ ]);
|
|
|
142
|
+ $cmb->add_field([
|
|
128
|
143
|
'name' => __( 'End Date', 'cmb2' ),
|
|
129
|
144
|
'desc' => __( 'The date your exhibition ends', 'cmb2' ),
|
|
130
|
145
|
'id' => 'exhibit-end-date',
|
|
131
|
146
|
'type' => 'text_date_timestamp'
|
|
132
|
|
- ) );
|
|
|
147
|
+ ]);
|
|
133
|
148
|
}
|
|
134
|
149
|
?>
|