Featured Image linked

January 2013 WordPress Theme
GK User
Tue Mar 19, 2013 12:50 pm
Hi!

I'd like to have the featured image linked to the big image (which then I will open in a popup.

What' the function to be called

Now:

<figure class="featured-image">
<?php the_post_thumbnail(); ?>

<?php if(is_single()) : ?>
<?php echo gk_post_thumbnail_caption(); ?>
<?php endif; ?>
</figure>

Later:

<figure class="featured-image">
<a href="path of the featured image" class="socialGallery">
<?php the_post_thumbnail(); ?>
</a>

<?php if(is_single()) : ?>
<?php echo gk_post_thumbnail_caption(); ?>
<?php endif; ?>

</figure>

So, how can I write the path of the featured image?

Thanks
User avatar
Fresh Boarder

GK User
Tue Mar 19, 2013 4:55 pm
Hi,

You can retrieve the featured image url using the following code:

Code: Select all
$img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
$img_url = $img[0];


then the URL is stored in the $img_url variable.
User avatar
Administrator


cron