mercredi 22 avril 2015

Get WooCommerce product gallery image caption

Quick Question for someone who knows their wordpress.

I'm using the following code to show the WC product gallery on the product page (in the right order).

Someone can quickly point me in the direction of including the image caption between the <p>'s?

global $product;
$attachment_ids = $product->get_gallery_attachment_ids();

echo '<div class="flexslider"><ul class="slides">';
foreach( $attachment_ids as $attachment_id ) 
{
echo '<li>';
  echo "<img src=".$image_link = wp_get_attachment_url( $attachment_id, 'large').">";
  echo '<p>';
  echo '</p>';
  echo '</li>';
}
echo '</ul></div>';

Aucun commentaire:

Enregistrer un commentaire