Get featured image url and link to it
-
I’m not a coder, but I do understand some code and have successfully modified a lot of it, but I just can’t wrap my head around this one. And it seems so easy. So, this is part of the code of a gallery page. Thing is, when I click on the picture, it links me to the permalink. I don’t want it to link me to the permalink, but to the featured image url. How can I do this? Can somebody PLEASE help. Here’s the code:
<div <?php post_class("gallery-item isotope-item $term_list"); ?> > <?php $image_id = get_post_thumbnail_id(); global $gallery_image_size; $featured_image = wp_get_attachment_image_src( $image_id, $gallery_image_size ); ?> <a href="<?php the_permalink(); ?>"><?php echo '<img src="'.$featured_image[0].'" alt="'.get_the_title().'">'; ?></a> <?php if ( $terms && !is_wp_error( $terms ) ): $i = 0; $count = count($terms); endif; ?> </div>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get featured image url and link to it’ is closed to new replies.