Changing images for different variations
-
Hi
My theme displays only the featured image, and the images from the gallery, but i want it to fetch the images from each variation, and that they change when one changes the variation.
I got this code from functions/fetch-product.php:
<ul class="gallery-container gallery-image clearfix"> <?php $attach_args = array("post_type" => "attachment", "post_parent" => $post->ID, "numberposts" => "-1", "orderby" => "menu_order", "order" => "ASC"); $attachments = get_posts($attach_args); if ( !empty($attachments) ) : foreach($attachments as $attachement => $this_attachment) : $image = wp_get_attachment_image_src($this_attachment->ID, "340"); $full = wp_get_attachment_image_src($this_attachment->ID, "full"); ?> <li> <a href="<?php echo $full[0]; ?>" rel="lightbox"> <img src="<?php echo $image[0]; ?>" alt="<?php echo $this_attachment->post_title; ?>" /> </a> </li>
Can someone help me?
António
- The topic ‘Changing images for different variations’ is closed to new replies.