diff --git a/soundmap.php b/soundmap.php index 8a9631a..37fe978 100644 --- a/soundmap.php +++ b/soundmap.php @@ -404,6 +404,15 @@ if (!class_exists('Soundmap')){ ) ); + add_action('rest_api_init', + register_rest_field('marker','author', + array( + 'get_callback' => 'marker_get_author', + 'schema' => null + ) + ) + ); + function marker_get_georeference ($object, $field_name, $request){ //return $object['id']; $lat = get_post_meta($object['id'], 'soundmap_marker_lat', true); @@ -411,6 +420,10 @@ if (!class_exists('Soundmap')){ return [$lng,$lat]; } + function marker_get_author ($object,$field_name, $request) { + return get_post_meta($object['id'],'soundmap_marker_author',true); + } + function marker_get_media ($object, $field_name, $request) { $files = get_post_meta($object['id'], 'soundmap_attachments_id', FALSE); $files_str = [];