<?php
function bricks_append_product_gallery_images() {
global $post;
if (!$post || get_post_type($post->ID) !== 'product') {
return '';
}
// Get product gallery images
$gallery_images = get_post_meta($post->ID, '_product_image_gallery', true);
// Return early if no gallery images found
if (empty($gallery_images)) {
return '';
}
$image_ids = explode(',', $gallery_images);
$output = '';
// Function to get image dimensions
function get_image_dimensions($image_id) {
$image = wp_get_attachment_metadata($image_id);
return $image ? ['width' => $image['width'], 'height' => $image['height']] : ['width' => 800, 'height' => 800]; // Fallback size
}
// Loop through gallery images
foreach ($image_ids as $image_id) {
$image_url = wp_get_attachment_image_url($image_id, 'full');
$image_size = get_image_dimensions($image_id);
if ($image_url) {
$output .= '<a href="' . esc_url($image_url) . '" class="brxe-image tag bricks-lightbox"
data-pswp-src="' . esc_url($image_url) . '"
data-pswp-width="' . esc_attr($image_size['width']) . '"
data-pswp-height="' . esc_attr($image_size['height']) . '">
<img src="' . esc_url($image_url) . '" class="css-filter size-large" />
</a>';
}
}
// Wrap the output inside the product-images div
$output = '<script>
document.addEventListener("DOMContentLoaded", function() {
let productImagesDiv = document.querySelector(".product-images");
if (productImagesDiv) {
productImagesDiv.innerHTML += `' . addslashes($output) . '`;
}
});
</script>';
return $output;
}
// Register shortcode
add_shortcode('append_product_gallery_images', 'bricks_append_product_gallery_images');
?><?php
function custom_product_images_with_variations() {
global $post, $product;
if ( ! $post || get_post_type( $post->ID ) !== 'product' ) {
return '';
}
// 1. Collect image IDs: featured image first, then gallery images (avoiding duplicates)
$images = array();
$featured_image_id = get_post_thumbnail_id( $post->ID );
if ( $featured_image_id ) {
$images[] = $featured_image_id;
}
$gallery_images = get_post_meta( $post->ID, '_product_image_gallery', true );
if ( ! empty( $gallery_images ) ) {
$gallery_ids = explode( ',', $gallery_images );
foreach ( $gallery_ids as $id ) {
if ( ! in_array( $id, $images ) ) {
$images[] = $id;
}
}
}
// 2. Build a mapping of variation value (for Colors) to image ID.
// This example assumes a variable product using the "Colors" attribute (attribute_pa_colors).
$variation_mapping = array();
if ( $product && $product->is_type( 'variable' ) ) {
$available_variations = $product->get_available_variations();
foreach ( $available_variations as $variation ) {
if ( isset( $variation['attributes']['attribute_pa_colors'] ) && ! empty( $variation['attributes']['attribute_pa_colors'] ) ) {
$color = strtolower( $variation['attributes']['attribute_pa_colors'] );
$variation_image_id = $variation['image_id'];
if ( $variation_image_id && ! isset( $variation_mapping[ $color ] ) ) {
$variation_mapping[ $color ] = $variation_image_id;
}
}
}
}
// 3. Build the HTML for the images.
// Each image is wrapped in an anchor that has the lightbox classes and data attributes.
$html = '';
foreach ( $images as $image_id ) {
$image_url = wp_get_attachment_image_url( $image_id, 'full' );
$image_meta = wp_get_attachment_metadata( $image_id );
$width = isset( $image_meta['width'] ) ? $image_meta['width'] : 800;
$height = isset( $image_meta['height'] ) ? $image_meta['height'] : 800;
// Get alt text; fallback to the filename (without extension) if empty.
$image_alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true );
if ( empty( $image_alt ) ) {
$attachment = get_post( $image_id );
$image_alt = $attachment ? pathinfo( $attachment->guid, PATHINFO_FILENAME ) : '';
}
// If this image is used as a variation image, add a data attribute.
$data_variation = '';
$found_variation = array_search( $image_id, $variation_mapping );
if ( $found_variation !== false ) {
$data_variation = ' data-variation="' . esc_attr( $found_variation ) . '"';
}
if ( $image_url ) {
// IMPORTANT: Use the classes your lightbox expects.
$html .= '<a href="' . esc_url( $image_url ) . '" class="brxe-image tag bricks-lightbox"'. $data_variation .' data-pswp-src="' . esc_url( $image_url ) . '" data-pswp-width="' . esc_attr( $width ) . '" data-pswp-height="' . esc_attr( $height ) . '">';
$html .= '<img src="' . esc_url( $image_url ) . '" alt="' . esc_attr( $image_alt ) . '" class="custom-image" />';
$html .= '</a>';
}
}
// 4. Wrap all images in a container.
$output = '<div class="custom-product-images">'.$html.'</div>';
return $output;
}
add_shortcode('custom_product_images', 'custom_product_images_with_variations');
?>
document.addEventListener("DOMContentLoaded", function(){
var container = document.querySelector(".custom-product-images");
if (!container) return;
// Save the original order of the image anchors.
var originalNodes = Array.from(container.children);
function reorderImages(selectedValue) {
// If no variation is selected, remove any highlight and restore original order.
if (!selectedValue) {
container.querySelectorAll("a.highlight").forEach(function(a) {
a.classList.remove("highlight");
});
while (container.firstChild) {
container.removeChild(container.firstChild);
}
originalNodes.forEach(function(node) {
container.appendChild(node);
});
return;
}
// If a variation is selected, find the corresponding image link.
var target = container.querySelector('a[data-variation="' + selectedValue.toLowerCase() + '"]');
if (target) {
container.querySelectorAll("a.highlight").forEach(function(a) {
a.classList.remove("highlight");
});
target.classList.add("highlight");
container.insertBefore(target, container.firstChild);
}
}
// Listen for changes on the hidden select element.
var variationSelect = document.querySelector("select[name='attribute_pa_colors']");
if (variationSelect) {
variationSelect.addEventListener("change", function(){
var selected = variationSelect.value;
reorderImages(selected);
});
}
// Listen for clicks on radio-style variation selectors.
var variationRadios = document.querySelectorAll("[data-attribute_name='attribute_pa_colors']");
variationRadios.forEach(function(radio){
radio.addEventListener("click", function(){
// After the click, check if any radio still has the "selected" class.
var selectedRadio = document.querySelector("li.selected[data-attribute_name='attribute_pa_colors']");
if (selectedRadio) {
var val = selectedRadio.getAttribute("data-value");
reorderImages(val);
} else {
// If none are selected, clear the highlight and restore original order.
reorderImages("");
}
});
});
// Listen for clicks on the clear variations link.
var clearBtn = document.querySelector(".reset_variations");
if (clearBtn) {
clearBtn.addEventListener("click", function(e){
e.preventDefault(); // Prevent default behavior if needed.
// Remove "selected" class from all radio items.
variationRadios.forEach(function(radio){
radio.classList.remove("selected");
});
// Reset the select value.
if (variationSelect) {
variationSelect.value = "";
}
// Revert images to original order.
reorderImages("");
});
}
});Kimono-Velours-Beige
$ 265.70
Ce kimono en velours beige, entièrement confectionné en Italie, incarne le raffinement et la douceur. Sa texture riche et fluide en viscose offre un tombé parfait et un confort incomparable. Polyvalent, il se porte aussi bien comme veste légère sur une tenue casual que comme pièce maîtresse pour un look du soir. Un essentiel chic et intemporel.
-
Matière : 100% viscose – velours doux
-
Couleur : beige sable
-
Origine : Made in Italy
Crafted in Italy from soft viscose velvet, this beige kimono embodies understated luxury and comfort. Its fluid drape and rich texture make it a versatile piece — perfect as a light jacket for everyday outfits or as a refined statement layer for evening looks. A timeless, chic essential.
-
Fabric: 100% viscose – soft velvet
-
Color: sand beige
-
Origin: Made in Italy
-
Similar to this

Kimono Géo Green
$ 297.14

Kimono-Camelia-Noir
$ 375.75

Kimono Masdala vert
$ 265.70

Kimono-Begonia-Olive
$ 375.75









