Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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

    #524726

    Hey stefaniesomers!

    Can i check your product site?
    Lightbox effect, should be there by default.

    Regards,
    Basilis

    #524815

    Hey 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 clear

    Thank you!

    Stefanie

    #524864

    Hey Stefanie!

    Please go to Media > Library and add description to your images – http://i.imgur.com/ljVcHFV.jpg

    Best regards,
    Yigit

    #524868

    Yigit – 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!

    #524870

    Hey!

    Do you mind creating a temporary admin login and posting it here privately so we can look into it?

    Best regards,
    Yigit

    #525230

    Hi 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

    #526815

    Hi!

    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!
    Andy

    #526946

    Hi,
    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

    .

    #527102

    Dang.

    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.

    #527846

    Hey!

    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

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.