Skip to content

Instantly share code, notes, and snippets.

View quangbeo216's full-sized avatar

Quang béo quangbeo216

View GitHub Profile
@quangbeo216
quangbeo216 / gist:ddec62737d4ad69e1c43c37fac303d5d
Created April 25, 2018 06:50 — forked from Niloys7/gist:17b88d36c1c38844a6cf2127c15dee63
Get Product Gallery Images - WooCommerce
<?php
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
foreach( $attachment_ids as $attachment_id )
{
//Get URL of Gallery Images - default wordpress image sizes
echo $Original_image_url = wp_get_attachment_url( $attachment_id );
echo $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0];
echo $medium_url = wp_get_attachment_image_src( $attachment_id, 'medium' )[0];