Displaying a clickable image
-
Hi,
I am using an image custom field that allows for more than one instance to displaying thumbnails on a product page. I am using this chunk of code to display them
<ul id="product-images"> <li> <img src='<?php echo types_render_field("product-image", array("raw"=>"true","separator"=>"'></li><li><img src='")); ?>'> </li> </ul>
but I want to be able to click on them and they open in a new tab/window.
I started by surrounding the images with an ‘a’ tag and put the same ‘types_render_field’ tag in the href but that didn’t work properly and got messy with the ‘separators’ after the first image and link. Then I tried to implement something along these lines<?php if ( get_post_meta( get_the_ID(), 'product-image', true ) ) : ?> <a href="<?php the_permalink() ?>"> <img src="<?php echo get_post_meta( get_the_ID(), 'product-image', true ); ?>" /> </a> <?php endif; ?>
but I couldn’t get this to work either.
Any suggestions?
Here is the link to my site and product page I am referring to ARC Crafts
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Displaying a clickable image’ is closed to new replies.