Home>Support>Image Grid widget, how to link individual images in grid

Image Grid widget, how to link individual images in grid

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

I’m using the Image Grid widget in a page builder layout in a Harmonic child theme.

I need the images in the grid to each link to separate urls, so when adding images to the grid, I also insert the destination I want each image to link to by adding the appropriate link to the URL field.

However, when I open the page, I see the images, but none them link. Inspecting an image with Firebug reveals that there is no link in the code.

Is this an issue with the Image Grid widget?

I can’t share an example as I’m working on localhost

Thanks in advance

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 8 months ago davidsword

    in

    widgets/so-image-grid-widget/tpl/default.php

    change

    		<?php
    		foreach( $instance['images'] as $image ) {
    			echo '<div class="sow-image-grid-image">';
    			echo wp_get_attachment_image( $image['image'], $image['display']['image_size'], false, array(
    				'title' => $image['title']
    			) );
    			echo '</div>';
    		}
    		?>
    

    to

    		<?php
    		foreach( $instance['images'] as $image ) {
    			echo '<div class="sow-image-grid-image">';
    			echo (!empty($image['url'])) ? "<a href='{$image['url']}'>" : '';
    			echo wp_get_attachment_image( $image['image'], $image['display']['image_size'], false, array(
    				'title' => $image['title']
    			) );
    			echo (!empty($image['url'])) ? "</a>" : '';
    			echo '</div>';
    		}
    		?>
    
  2. 9 years, 8 months ago davidsword

    this won’t stick on any plugin update.

    hopefully an mod see’s this and submit it to code.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More