Post Thumbnail
If you need to modify the post thumbnail of the theme to set programatically the one from the slots you could use this code:
add_filter('post_thumbnail_html', 'use_external_featured_image', 10, 3);
function use_external_featured_image($html, $post_id, $post_thumbnail_id) {
// Only apply to slotsl post type
if (get_post_type($post_id) !== 'slotsl') {
return $html;
}
// If featured image already exists, keep it
if (!empty($html)) {
return $html;
}
// Get your external image URL
$external_url = slotsl_img_url();
if (empty($external_url)) {
return $html;
}
// Build image manually
$alt = esc_attr(get_the_title($post_id));
return sprintf(
'<img src="%s" alt="%s" class="wp-post-image external-slotsl-image" loading="lazy">',
esc_url($external_url),
$alt
);
}