进行了一些小修复
This commit is contained in:
1 parent
992af2119d
commit
2cb78edabb
26 files changed
+2091
-2383
No files matched your search
@@ -66,13 +66,21 @@ if ($edit_post) {
|
||||
];
|
||||
} elseif (!empty($post_meta['featured_slide'])) {
|
||||
$slides = array_filter(array_map('trim', explode(',', (string) $post_meta['featured_slide'])));
|
||||
$featured_args['type'] = 'slide';
|
||||
$featured_args['data'] = array_map(static function ($u) {
|
||||
return ['url' => $u];
|
||||
}, $slides);
|
||||
$slide_data = [];
|
||||
foreach ($slides as $attachment_id) {
|
||||
$id = absint($attachment_id);
|
||||
$url = $id > 0 ? wp_get_attachment_image_url($id, 'full') : false;
|
||||
if ($url) {
|
||||
$slide_data[] = ['id' => $id, 'url' => $url];
|
||||
}
|
||||
}
|
||||
if ($slide_data) {
|
||||
$featured_args['type'] = 'slide';
|
||||
$featured_args['data'] = $slide_data;
|
||||
}
|
||||
} else {
|
||||
$thumb = get_the_post_thumbnail_url($edit_post, 'full')
|
||||
?: (string) ($post_meta['thumbnail_url'] ?? $post_meta['cover_images'] ?? '');
|
||||
?: (string) ($post_meta['thumbnail_url'] ?? $post_meta['cover_image'] ?? '');
|
||||
if ($thumb !== '') {
|
||||
$featured_args['type'] = 'image';
|
||||
$featured_args['data'] = ['url' => $thumb];
|
||||
|
||||
Reference in new issue
Block a user