<?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("");
});
}
});Gingham Check Formal Shirt.
Original price was: ₨ 3,000.₨ 2,600Current price is: ₨ 2,600.
- Description
Brand: Urban Attire
Shirt Type: Formal/Semi casual
Sleeves: Full Sleeves
Collars Type: Semi Spread
Fabric: Extra Fine Cotton
Pattern: Check
Country Origin: Pakistan - Shipping & Returns
Returns Policy
You may return most new, unopened items within 30 days of delivery for a full refund. We’ll also pay the return shipping costs if the return is a result of our error (you received an incorrect or defective item, etc.).
You should expect to receive your refund within four weeks of giving your package to the return shipper, however, in many cases you will receive a refund more quickly.
This time period includes the transit time for us to receive your return from the shipper (5 to 10 business days), the time it takes us to process your return once we receive it (3 to 5 business days), and the time it takes your bank to process our refund request (5 to 10 business days).
If you need to return an item, simply login to your account, view the order using the “Complete Orders” link under the My Account menu and click the Return Item(s) button. We’ll notify you via e-mail of your refund once we’ve received and processed the returned item.
Shipping
We can ship to virtually any address in the world. Note that there are restrictions on some products, and some products cannot be shipped to international destinations.
When you place an order, we will estimate shipping & delivery dates for you based on the availability of your items and the shipping options you choose. Depending on the shipping provider you choose, shipping date estimates may appear on the shipping quotes page.
Please also note that the shipping rates for many items we sell are weight-based. The weight of any such item can be found on its detail page. To reflect the policies of the shipping companies we use, all weights will be rounded up to the next full pound.
- DisclaimerDue to photography lighting sources or your display settings, product color may vary slightly.
More Products

White & Blue Fine check, Elite Edition Formal Autograph Shirt
Original price was: ₨ 3,000.₨ 2,600Current price is: ₨ 2,600.

Multicolor Tattersall Check Formal Autograph Shirt
Original price was: ₨ 3,000.₨ 2,600Current price is: ₨ 2,600.

Sky Blue Fine Striped, Elite Edition, Cutaway Collar Men’s Formal Shirt
Original price was: ₨ 3,000.₨ 2,600Current price is: ₨ 2,600.

Dark Blue Gingham Check Formal Shirt
Original price was: ₨ 3,000.₨ 2,600Current price is: ₨ 2,600.








