Created
March 10, 2021 03:50
-
-
Save wplit/5523941c7b5a77b993bb9c3b595eb6d4 to your computer and use it in GitHub Desktop.
output woocommerce gallery images. (inside product builder inside a code block)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $product; | |
$image_size = 'medium'; /* Image size */ | |
$attachment_ids = $product->get_gallery_image_ids(); | |
foreach( $attachment_ids as $attachment_id ) { | |
$image_url = wp_get_attachment_image_src( $attachment_id, $image_size )[0]; | |
echo '<img src="' . $image_url . '" class="cell">'; /* Needs cell class to be used inside carousel */ | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment