From 838f90cdf4375f7af03c3f6c585f85634a76915a Mon Sep 17 00:00:00 2001 From: lrullo Date: Mon, 12 Nov 2018 18:04:13 +0100 Subject: [PATCH] Add support for API Rest on endpoind /wp-json/wp/v2/marker/:id --- soundmap.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/soundmap.php b/soundmap.php index 58660ec..ef01e4f 100644 --- a/soundmap.php +++ b/soundmap.php @@ -47,7 +47,7 @@ if (!class_exists('Soundmap')){ 'not_found' => __('No markers found', 'soundmap'), 'not_found_in_trash' => __('No markers found in Trash', 'soundmap'), 'parent_item_colon' => '', - 'menu_name' => 'Markers' + 'menu_name' => 'Markers' ); $args = array( @@ -60,6 +60,7 @@ if (!class_exists('Soundmap')){ 'rewrite' => array( 'slug' => 'marker', 'with_front' => false ), 'capability_type' => 'post', 'has_archive' => true, + 'show_in_rest' => true, 'hierarchical' => false, 'menu_position' => 5, 'register_meta_box_cb' => array($this, 'metaboxes_register_callback'), @@ -82,7 +83,8 @@ if (!class_exists('Soundmap')){ add_meta_box('soundmap-map', __("Place the Marker", 'soundmap'), array($this, 'map_meta_box'), 'marker', 'normal', 'high'); add_meta_box('soundmap-media-info', __("Info", 'soundmap'), array($this,'info_meta_box'), 'marker', 'side', 'high'); add_meta_box('soundmap-media-attachments', __("Media files attached.", 'soundmap'), array($this, 'attachments_meta_box'), 'marker', 'side', 'high'); - add_meta_box('soundmap-email', __("Uploader Mail", 'soundmap'), array($this, 'email_meta_box'), 'marker', 'side', 'low'); + // Ya no es necesario + //add_meta_box('soundmap-email', __("Uploader Mail", 'soundmap'), array($this, 'email_meta_box'), 'marker', 'side', 'low'); } //metaboxes_register_callback function email_meta_box(){ @@ -334,7 +336,8 @@ if (!class_exists('Soundmap')){ }; }else{ delete_post_meta($post_id, 'soundmap_attachments_id'); - add_post_meta($post_id, 'soundmap_attachments_id', 'null'); + // PORQUE? esto genera un null + //add_post_meta($post_id, 'soundmap_attachments_id', 'null'); }; delete_transient( 'soundmap_JSON_markers' );