HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/dragonhs/public_html/wp-content/themes/instock-lite/woocommerce/image-swap.php
<?php

/**
 * Image Swap style thumbnail
 */

// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}

// Return dummy image if no featured image is defined
if (!has_post_thumbnail()) {
    if (function_exists('wc_placeholder_img_src') && wc_placeholder_img_src()) {
        $placeholder = '<img src="' . esc_url(wc_placeholder_img_src()) . '" alt="' . __('Placeholder Image', 'instock-lite') . '" class="woo-entry-image-main" />';
        $placeholder = apply_filters('instock_lite_woo_placeholder_img_html', $placeholder);
        if ($placeholder) {
            echo wp_filter_post_kses(placeholder);
        }
    }
    return;
}

// Globals
global $product;

// Get first image
$attachment = get_post_thumbnail_id();
$main_image = wp_get_attachment_image($attachment, 'woocommerce_thumbnail', false, array('class' => 'wc-product-image-main'));

// Get Second Image in Gallery
$attachment_ids           = $product->get_gallery_image_ids();
$attachment_ids[]         = $attachment; // Add featured image to the array
$secondary_attachment_url = '';

if (!empty($attachment_ids)) {
    $attachment_ids = array_unique($attachment_ids); // remove duplicate images
    if (count($attachment_ids) > '1') {
        if ($attachment_ids['0'] !== $attachment) {
            $secondary_img_id = $attachment_ids['0'];
        } elseif ($attachment_ids['1'] !== $attachment) {
            $secondary_img_id = $attachment_ids['1'];
        }
    }
}

// Get secondary image output
if (!empty($secondary_img_id)) {
    $secondary_image = wp_get_attachment_image($secondary_img_id, 'woocommerce_thumbnail', false, array('class' => 'wc-product-image-secondary'));
} else {
    $secondary_image = false;
}

// Return thumbnail
if ($main_image && $secondary_image) : ?>

    <div class="wc-product-thumbnail thumbnail-swap">
        <?php echo $main_image; ?>
        <?php echo $secondary_image; ?>
    </div>

<?php else : ?>

    <div class="wc-product-thumbnail">
        <?php echo $main_image; ?>
    </div>

<?php endif; ?>