revert to last healthy
This commit is contained in:
@@ -854,7 +854,6 @@ function igny8_set_featured_image($post_id, $image_data) {
|
||||
*/
|
||||
function igny8_set_image_gallery($post_id, $gallery_images) {
|
||||
$attachment_ids = array();
|
||||
$imported_images = array(); // For _igny8_imported_images meta with full metadata
|
||||
|
||||
// Limit to 5 images
|
||||
$gallery_images = array_slice($gallery_images, 0, 5);
|
||||
@@ -876,19 +875,6 @@ function igny8_set_image_gallery($post_id, $gallery_images) {
|
||||
|
||||
if ($attachment_id) {
|
||||
$attachment_ids[] = $attachment_id;
|
||||
|
||||
// Build complete image metadata for template
|
||||
$position = is_array($image_data) ? ($image_data['position'] ?? 0) : 0;
|
||||
$caption = is_array($image_data) ? ($image_data['caption'] ?? '') : ''; // Use caption instead of prompt
|
||||
$is_featured = is_array($image_data) ? ($image_data['is_featured'] ?? false) : false;
|
||||
|
||||
$imported_images[] = array(
|
||||
'position' => intval($position),
|
||||
'attachment_id' => $attachment_id,
|
||||
'url' => wp_get_attachment_url($attachment_id),
|
||||
'prompt' => $caption, // Store caption in prompt field for template compatibility
|
||||
'is_featured' => $is_featured
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,14 +887,6 @@ function igny8_set_image_gallery($post_id, $gallery_images) {
|
||||
update_post_meta($post_id, '_gallery_images', $attachment_ids); // Generic
|
||||
}
|
||||
|
||||
// Store complete image metadata for IGNY8 template
|
||||
if (!empty($imported_images)) {
|
||||
update_post_meta($post_id, '_igny8_imported_images', $imported_images);
|
||||
|
||||
$log_prefix = "[" . get_option('igny8_site_id', 'N/A') . "-" . parse_url(site_url(), PHP_URL_HOST) . "]";
|
||||
Igny8_Logger::info("{$log_prefix} ✅ Saved _igny8_imported_images meta with " . count($imported_images) . " images (positions: " . implode(', ', array_column($imported_images, 'position')) . ")");
|
||||
}
|
||||
|
||||
return $attachment_ids;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user