Fix conditionals order

This commit is contained in:
weryques 2018-02-23 18:50:44 -03:00
parent 318380ea9d
commit 766c02b90b
1 changed files with 3 additions and 5 deletions

View File

@ -289,11 +289,7 @@ abstract class Repository {
if(isset($entity->WP_Post->ID)) {
$property = get_the_post_thumbnail_url($entity->WP_Post->ID, 'full');
}
} else {
$property = isset($entity->WP_Post->$mapped) ? $entity->WP_Post->$mapped : null;
}
if($mapped == 'attachments'){
} elseif($mapped == 'attachments'){
if(isset($entity->WP_Post) && isset($entity->WP_Post->ID)){
$attachments_query = [
'post_type' => 'attachment',
@ -321,6 +317,8 @@ abstract class Repository {
$property = $attachments_prepared;
}
} else {
$property = isset($entity->WP_Post->$mapped) ? $entity->WP_Post->$mapped : null;
}
} elseif ( isset( $entity->WP_Term )) {
$property = isset($entity->WP_Term->$mapped) ? $entity->WP_Term->$mapped : null;