Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.

Commit ff7906b

Browse files
authored
Merge pull request #261 from PRX/feat/259-stations-content-type
Station Content Type
2 parents dcf0d96 + 1f4de9f commit ff7906b

3 files changed

Lines changed: 326 additions & 0 deletions

File tree

wp-content/mu-plugins/the-world-site-config/configs/global/global-plugins.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'tw-scroll-gallery/tw-scroll-gallery.php',
4545
'tw-sitemap-mask/tw-sitemap-mask.php',
4646
'tw-segments/tw-segments.php',
47+
'tw-stations/tw-stations.php',
4748
'tw-story-format/tw-story-format.php',
4849
'visual-term-description-editor/visual-term-description-editor.php',
4950
'wordpress-importer/wordpress-importer.php',
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
/**
3+
* Plugin Name: TW Stations
4+
* Description: Manages the station custom post type
5+
*
6+
* @package tw_stations
7+
*/
8+
9+
/**
10+
* Register Station Post Type.
11+
*
12+
* @return void
13+
*/
14+
function tw_stations_post_type() {
15+
16+
$labels = array(
17+
'name' => _x( 'Stations', 'Post Type General Name', 'text_domain' ),
18+
'singular_name' => _x( 'Station', 'Post Type Singular Name', 'text_domain' ),
19+
'menu_name' => __( 'Stations', 'text_domain' ),
20+
'name_admin_bar' => __( 'Stations', 'text_domain' ),
21+
'archives' => __( 'Item Archives', 'text_domain' ),
22+
'attributes' => __( 'Item Attributes', 'text_domain' ),
23+
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
24+
'all_items' => __( 'All stations', 'text_domain' ),
25+
'add_new_item' => __( 'Add New station', 'text_domain' ),
26+
'add_new' => __( 'Add New', 'text_domain' ),
27+
'new_item' => __( 'New station', 'text_domain' ),
28+
'edit_item' => __( 'Edit station', 'text_domain' ),
29+
'update_item' => __( 'Update station', 'text_domain' ),
30+
'view_item' => __( 'View station', 'text_domain' ),
31+
'view_items' => __( 'View station', 'text_domain' ),
32+
'search_items' => __( 'Search station', 'text_domain' ),
33+
'not_found' => __( 'Not found', 'text_domain' ),
34+
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
35+
'featured_image' => __( 'Featured Image', 'text_domain' ),
36+
'set_featured_image' => __( 'Set featured image', 'text_domain' ),
37+
'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
38+
'use_featured_image' => __( 'Use as featured image', 'text_domain' ),
39+
'insert_into_item' => __( 'Insert into item', 'text_domain' ),
40+
'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
41+
'items_list' => __( 'Items list', 'text_domain' ),
42+
'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
43+
'filter_items_list' => __( 'Filter items list', 'text_domain' ),
44+
);
45+
$args = array(
46+
'label' => __( 'Stations', 'text_domain' ),
47+
'description' => __( 'Manages the list of Stations that air The World', 'text_domain' ),
48+
'labels' => $labels,
49+
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ),
50+
'taxonomies' => array(),
51+
'rewrite' => array(
52+
'slug' => 'stations',
53+
'with_front' => false,
54+
),
55+
'hierarchical' => false,
56+
'public' => true,
57+
'publicly_queryable' => true,
58+
'show_ui' => true,
59+
'show_in_menu' => true,
60+
'menu_position' => 10,
61+
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode( '<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px" fill="black"><path d="M208-321q-52-53-82-122T96-592q0-80 30-149.5T208-864l52 51q-43 42-67.5 99T168-592q0 65 24.5 121t66.5 99l-51 51Zm104-103q-32-32-51-75t-19-93q0-50 19-93t51-75l51 51q-23 23-36 52.5T314-592q0 35 13 64.5t36 52.5l-51 51Zm-24 312 132-406q-17-14-26.5-32.5T384-592q0-40 28-68t68-28q40 0 68 28t28 68q0 24-10.5 43T537-516l111 404h-72l-20-72H384l-24 72h-72Zm119-144h129l-59-216-70 216Zm241-168-51-51q23-23 36-52.5t13-64.5q0-35-13-64.5T597-709l51-51q32 32 51 75t19 93q0 50-19 93t-51 75Zm103 103-51-51q43-42 67.5-98.5T792-592q0-65-24.5-121.5T701-813l51-51q52 53 82 122.5T864-592q0 80-30 149.5T751-321Z"/></svg>' ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
62+
'show_in_admin_bar' => true,
63+
'show_in_nav_menus' => true,
64+
'can_export' => true,
65+
'has_archive' => false,
66+
'exclude_from_search' => true,
67+
'capability_type' => array( 'station', 'stations' ),
68+
'capabilities' => array(
69+
'create_posts' => 'create_stations',
70+
),
71+
'map_meta_cap' => true,
72+
'show_in_rest' => true,
73+
'show_in_graphql' => true,
74+
'graphql_single_name' => 'station',
75+
'graphql_plural_name' => 'stations',
76+
);
77+
register_post_type( 'station', $args );
78+
}
79+
add_action( 'init', 'tw_stations_post_type', 0 );
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
{
2+
"key": "group_687ea335c5c2c",
3+
"title": "Station info",
4+
"fields": [
5+
{
6+
"key": "field_689ba465bba2b",
7+
"label": "Frequency Info",
8+
"name": "frequency_info",
9+
"aria-label": "",
10+
"type": "group",
11+
"instructions": "",
12+
"required": 0,
13+
"conditional_logic": 0,
14+
"wrapper": {
15+
"width": "",
16+
"class": "",
17+
"id": ""
18+
},
19+
"show_in_graphql": 1,
20+
"layout": "block",
21+
"sub_fields": [
22+
{
23+
"key": "field_687ea33a3f5b0",
24+
"label": "Frequency",
25+
"name": "frequency",
26+
"aria-label": "",
27+
"type": "text",
28+
"instructions": "",
29+
"required": 0,
30+
"conditional_logic": 0,
31+
"wrapper": {
32+
"width": "",
33+
"class": "",
34+
"id": ""
35+
},
36+
"show_in_graphql": 1,
37+
"default_value": "",
38+
"maxlength": "",
39+
"allow_in_bindings": 0,
40+
"placeholder": "",
41+
"prepend": "",
42+
"append": ""
43+
},
44+
{
45+
"key": "field_687ea40f3f5b1",
46+
"label": "Modulator",
47+
"name": "modulator",
48+
"aria-label": "",
49+
"type": "select",
50+
"instructions": "",
51+
"required": 0,
52+
"conditional_logic": 0,
53+
"wrapper": {
54+
"width": "",
55+
"class": "",
56+
"id": ""
57+
},
58+
"show_in_graphql": 1,
59+
"choices": {
60+
"FM": "FM",
61+
"AM": "AM",
62+
"FM2": "FM2"
63+
},
64+
"default_value": "FM",
65+
"return_format": "value",
66+
"multiple": 0,
67+
"allow_null": 0,
68+
"allow_in_bindings": 0,
69+
"ui": 0,
70+
"ajax": 0,
71+
"placeholder": "",
72+
"create_options": 0,
73+
"save_options": 0
74+
}
75+
]
76+
},
77+
{
78+
"key": "field_689ba40b3377d",
79+
"label": "Location",
80+
"name": "location",
81+
"aria-label": "",
82+
"type": "group",
83+
"instructions": "",
84+
"required": 0,
85+
"conditional_logic": 0,
86+
"wrapper": {
87+
"width": "",
88+
"class": "",
89+
"id": ""
90+
},
91+
"show_in_graphql": 1,
92+
"layout": "block",
93+
"sub_fields": [
94+
{
95+
"key": "field_689a4ce0b6e60",
96+
"label": "City",
97+
"name": "city",
98+
"aria-label": "",
99+
"type": "taxonomy",
100+
"instructions": "",
101+
"required": 0,
102+
"conditional_logic": 0,
103+
"wrapper": {
104+
"width": "",
105+
"class": "",
106+
"id": ""
107+
},
108+
"show_in_graphql": 1,
109+
"taxonomy": "city",
110+
"add_term": 1,
111+
"save_terms": 0,
112+
"load_terms": 0,
113+
"return_format": "id",
114+
"field_type": "select",
115+
"allow_null": 0,
116+
"allow_in_bindings": 0,
117+
"bidirectional": 0,
118+
"multiple": 0,
119+
"bidirectional_target": []
120+
},
121+
{
122+
"key": "field_689a4d22b6e62",
123+
"label": "State \/ Province",
124+
"name": "state_province",
125+
"aria-label": "",
126+
"type": "taxonomy",
127+
"instructions": "",
128+
"required": 0,
129+
"conditional_logic": 0,
130+
"wrapper": {
131+
"width": "",
132+
"class": "",
133+
"id": ""
134+
},
135+
"show_in_graphql": 1,
136+
"taxonomy": "province_or_state",
137+
"add_term": 1,
138+
"save_terms": 0,
139+
"load_terms": 0,
140+
"return_format": "id",
141+
"field_type": "select",
142+
"allow_null": 0,
143+
"allow_in_bindings": 0,
144+
"bidirectional": 0,
145+
"multiple": 0,
146+
"bidirectional_target": []
147+
},
148+
{
149+
"key": "field_689a4d0ab6e61",
150+
"label": "Country",
151+
"name": "country",
152+
"aria-label": "",
153+
"type": "taxonomy",
154+
"instructions": "",
155+
"required": 0,
156+
"conditional_logic": 0,
157+
"wrapper": {
158+
"width": "",
159+
"class": "",
160+
"id": ""
161+
},
162+
"show_in_graphql": 1,
163+
"taxonomy": "country",
164+
"add_term": 0,
165+
"save_terms": 0,
166+
"load_terms": 0,
167+
"return_format": "id",
168+
"field_type": "select",
169+
"allow_null": 0,
170+
"allow_in_bindings": 0,
171+
"bidirectional": 0,
172+
"multiple": 0,
173+
"bidirectional_target": []
174+
}
175+
]
176+
},
177+
{
178+
"key": "field_689ba27787ae5",
179+
"label": "Schedule",
180+
"name": "schedule",
181+
"aria-label": "",
182+
"type": "repeater",
183+
"instructions": "",
184+
"required": 0,
185+
"conditional_logic": 0,
186+
"wrapper": {
187+
"width": "",
188+
"class": "",
189+
"id": ""
190+
},
191+
"show_in_graphql": 1,
192+
"layout": "table",
193+
"pagination": 0,
194+
"min": 0,
195+
"max": 0,
196+
"collapsed": "",
197+
"button_label": "Add Row",
198+
"rows_per_page": 20,
199+
"sub_fields": [
200+
{
201+
"key": "field_689ba29587ae6",
202+
"label": "Start Time UTC",
203+
"name": "start_time_utc",
204+
"aria-label": "",
205+
"type": "time_picker",
206+
"instructions": "",
207+
"required": 0,
208+
"conditional_logic": 0,
209+
"wrapper": {
210+
"width": "",
211+
"class": "",
212+
"id": ""
213+
},
214+
"show_in_graphql": 1,
215+
"display_format": "g:i a",
216+
"return_format": "H:i:s",
217+
"allow_in_bindings": 0,
218+
"parent_repeater": "field_689ba27787ae5"
219+
}
220+
]
221+
}
222+
],
223+
"location": [
224+
[
225+
{
226+
"param": "post_type",
227+
"operator": "==",
228+
"value": "station"
229+
}
230+
]
231+
],
232+
"menu_order": 0,
233+
"position": "acf_after_title",
234+
"style": "seamless",
235+
"label_placement": "top",
236+
"instruction_placement": "label",
237+
"hide_on_screen": "",
238+
"active": true,
239+
"description": "",
240+
"show_in_rest": 1,
241+
"show_in_graphql": 1,
242+
"graphql_field_name": "station_info",
243+
"map_graphql_types_from_location_rules": 0,
244+
"graphql_types": "",
245+
"modified": 1755030771
246+
}

0 commit comments

Comments
 (0)