• Hey guys,

    For some reason the theme my client is using does not include the product thumbnails / image’s link to the image file. Meaning, I can’t use the lightbox to enlarge the image or any zoom magnifier plugins.

    Maybe you could help me figuring out what do I need to edit?

    This is the single-product.php code regarding the product images:

    <div class="single_image">
                      <?php
                      if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) {
                       echo the_post_thumbnail('page-single');
                     } else {
                       inkthemes_get_image(600, 300);
                     } ?></div>

    The inkthemes_get_image function code is:

    function inkthemes_get_image($width, $height) {
        $w = $width;
        $h = $height;
        global $post, $posts;
    //This is required to set to Null
        $img_source = '';
        $permalink = get_permalink($id);
        ob_start();
        ob_end_clean();
        $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
        if (isset($matches [1] [0])) {
            $img_source = $matches [1] [0];
        }
        $img_path = inkthemes_image_resize($img_source, $w, $h);
        if (!empty($img_path[url])) {
            print "<a href='$permalink'><img src='$img_path[url]' class='postimg' alt='Post Image'/></a>";

    What do I need to do for it to work? :\

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Kettercat

    (@kettercat)

    Anyone knows?
    Thanks!

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Looks like the theme tries to pull the first image from the content rather than using the featured image. This is technically something you should be contacting the theme authors about, as WooCommerce isn’t the reason this is happening.

    That said, you’ll need to create a child theme and override their image function / template. Should be able to just place the default WooCommerce image template in your child theme and it will override the changes: http://docs.woothemes.com/document/template-structure/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add link to product image’ is closed to new replies.