Merge lp:~steverydz/resource-centre/resource-centre into lp:resource-centre

Proposed by Steve Rydz on 2018-05-25
Status: Merged
Approved by: Anthony Dillon on 2018-05-25
Approved revision: 108
Merged at revision: 108
Proposed branch: lp:~steverydz/resource-centre/resource-centre
Merge into: lp:resource-centre
Diff against target: 34 lines (+17/-0)
1 file modified
functions/event-posts.php (+17/-0)
To merge this branch: bzr merge lp:~steverydz/resource-centre/resource-centre
Reviewer Review Type Date Requested Status
Anthony Dillon 2018-05-25 Approve on 2018-05-25
Review via email: mp+346871@code.launchpad.net

Commit message

Expose events data in rest api

Description of the change

Expose events data in rest api

To post a comment you must log in.
Anthony Dillon (ya-bo-ng) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'functions/event-posts.php'
2--- functions/event-posts.php 2018-03-21 20:01:42 +0000
3+++ functions/event-posts.php 2018-05-25 10:57:31 +0000
4@@ -87,6 +87,14 @@
5 'update_callback' => null,
6 'schema' => null,
7 )
8+ );
9+ register_rest_field( 'post',
10+ $field,
11+ array(
12+ 'get_callback' => 'slug_get_event_data',
13+ 'update_callback' => null,
14+ 'schema' => null,
15+ )
16 );
17 }
18 }
19@@ -113,6 +121,15 @@
20 }
21 add_action( 'admin_init', 'ep_eventposts_metaboxes' );
22
23+function ep_posts_metaboxes() {
24+ add_meta_box( 'ept_event_date_start', 'Start Date', 'ept_event_date', 'post', 'side', 'default', array( 'id' => '_start') );
25+ add_meta_box( 'ept_event_date_end', 'End Date', 'ept_event_date', 'post', 'side', 'default', array('id'=>'_end') );
26+ add_meta_box( 'ept_event_location', 'Event Location', 'ept_event_location', 'post', 'normal', 'default', array('id'=>'_end') );
27+ add_meta_box( 'ept_event_venue', 'Event Venue', 'ept_event_venue', 'post', 'normal', 'default', array('id'=>'_end') );
28+ add_meta_box( 'ept_event_registration', 'Event registration', 'ept_event_registration', 'post', 'normal', 'default', array('id'=>'_end') );
29+}
30+add_action( 'admin_init', 'ep_posts_metaboxes' );
31+
32 // Metabox HTML
33
34 function ept_event_date($post, $args) {

Subscribers

People subscribed via source and target branches