-
AuthorPosts
-
October 26, 2015 at 6:12 am #524640
Hi Guys,
Not entirely sure if this is a question for you or for Woo, but I’m hitting you up first. On the WooCommerce product page, I would like to have the image caption show somewhere when the thumbnail is clicked, bringing up the larger image in the lightbox – preferably along the bottom of the image if I have a choice, but I’m not overly picky.
Is there a way to do this I’ve missed, or a bit of CSS to accomplish it? Or do I need to go talk to the Woo guys?
here’s what I’m talking about if I’m not explaining well:
https://www.dropbox.com/s/8g79fm889rd41c7/ImageCaptionExample.jpg?dl=0 (in an ideal world, I’d love the red bar to be the Image Caption – if not, I’ll take it where I can get it)Thanks!!
Stefanie
October 26, 2015 at 9:07 am #524726Hey stefaniesomers!
Can i check your product site?
Lightbox effect, should be there by default.Regards,
BasilisOctober 26, 2015 at 12:27 pm #524815Hey Basilis,
I think you misunderstood me, my light box is fine. I’m trying get the image captions into the mix.. But if you’d like to take a look, I’m at https//:www.stefaniesomers.com
Check any of the e-com stuff – you can get there by going to Collections > Ready-to-Wear, and anything in that column is going to be in Woo.
The link belonging to the screen capture is:
https://www.stefaniesomers.com/product/california-crystal-cluster-drop-hoop-earrings/
I’m sorry if I wasn’t clearThank you!
Stefanie
October 26, 2015 at 2:03 pm #524864Hey Stefanie!
Please go to Media > Library and add description to your images – http://i.imgur.com/ljVcHFV.jpg
Best regards,
YigitOctober 26, 2015 at 2:06 pm #524868Yigit – my images DO have descriptions. Every one of them.
EDIT: not descriptions – Captions. I have over 700 images that already have captions assigned. I need to get the Captions in there. I really don’t want to go back and re-do a different field on this many images. Is there a way to do this?
Thanks!
- This reply was modified 9 years, 2 months ago by stefaniesomers.
October 26, 2015 at 2:09 pm #524870Hey!
Do you mind creating a temporary admin login and posting it here privately so we can look into it?
Best regards,
YigitOctober 26, 2015 at 11:26 pm #525230Hi Yigit,
Credentials below.
Here’s a good example:
https://www.stefaniesomers.com/product/california-crystal-cluster-drop-hoop-earrings/
Anything under “Ready-to-Wear” is similarly situated.Thank you very much.
Stefanie
October 29, 2015 at 3:06 pm #526815Hi!
this question would be best asked in WooCommerce Support, as they know their plugin best. However, try this code in your (child’s) functions.php:
function wp_get_attachment( $attachment_id ) { $attachment = get_post( $attachment_id ); return array( 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'href' => get_permalink( $attachment->ID ), 'src' => $attachment->guid, 'title' => $attachment->post_title ); } 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>'; $attachment_meta = wp_get_attachment($attachment_id); echo $attachment_meta['caption']; echo '</p>'; echo '</li>'; } echo '</ul></div>';
Cheers!
AndyOctober 29, 2015 at 4:39 pm #526946Hi,
I have the same necessity and I just tried this code on funciotns.php. The result is:Fatal error: Call to a member function get_gallery_attachment_ids() on null in W:\EasyPHP-DevServer-14.1VC11\data\localweb\ww\wp-content\themes\enfold-child\functions.php on line 43
.
October 29, 2015 at 7:53 pm #527102Dang.
hexsquare – thanks for going in first.
I’ll try this on my dev site and let y’all know what I get. And I’ll holler to Woo.
October 31, 2015 at 5:24 am #527846Hey!
Please edit js > avia.js file, look for this code around line 917:
var title = item.el.attr('title'); if(!title) title = item.el.find('img').attr('title');
.. replace it with:
var title = item.el.attr('title'); if(!title) title = item.el.find('img').attr('alt');
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.