Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
839497aa97
|
@ -59,10 +59,23 @@ class JSON_flat extends Exposer {
|
|||
);
|
||||
}
|
||||
);
|
||||
$item_document = array(
|
||||
'type' => $item['document_type'],
|
||||
'value' => ''
|
||||
);
|
||||
if($item_document['type'] == 'url') {
|
||||
$item_document['value'] = $item['document'];
|
||||
} elseif ( $item_document['type'] == 'text' ) {
|
||||
$item_document['value'] = $item['document_as_html'];
|
||||
} elseif ( $item_document['type'] == 'attachment' ) {
|
||||
$item_document['value'] = wp_get_attachment_url($item['document']);
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $item['id'],
|
||||
'data' => $item_data,
|
||||
'url' => $item['url'],
|
||||
'document' => $item_document,
|
||||
'thumbnail' => isset($item['_thumbnail_id']) ? wp_get_attachment_image_src($item['_thumbnail_id'], 'full') : false,
|
||||
'creation_date' => isset($item['creation_date']) ? $item['creation_date'] : '',
|
||||
'modification_date' => isset($item['modification_date']) ? $item['modification_date'] : ''
|
||||
|
|
|
@ -37,4 +37,16 @@ if(!function_exists("is_post_status_viewable")) {
|
|||
|
||||
return $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function tainacan_set_log_slug( $override, $slug, $post_ID, $post_status, $post_type, $post_parent ) {
|
||||
if ( 'tainacan-log' === $post_type ) {
|
||||
if ( $post_ID ) {
|
||||
return uniqid( $post_type . '-' . $post_ID );
|
||||
}
|
||||
return uniqid( $post_type . '-' );
|
||||
}
|
||||
return $override;
|
||||
}
|
||||
add_filter( 'pre_wp_unique_post_slug', 'tainacan_set_log_slug', 10, 6 );
|
Loading…
Reference in New Issue