Add support for API Rest on endpoind /wp-json/wp/v2/marker/:id

This commit is contained in:
lrullo 2018-11-12 18:04:13 +01:00
parent 41a98ca2f6
commit 838f90cdf4

View File

@ -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' );