This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Image Grid widget, how to link individual images in grid

10 years ago · Last reply by davidsword 10 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

2
  1. davidsword 10 years, 4 months ago

    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. davidsword 10 years, 4 months ago

    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.

Have a different question or issue?

Start New Thread