Support » Plugins » Get Post Thumnbail URL

  • Resolved aminabbasian


    I have set up post thumbnails as set out in this tutorial.

    I call on the image to show in a post by using
    <?php the_post_thumbnail('my-custom-image'); ?>

    This works great, I would however like this image to be linked so that it opens with fancybox showing the full image size.

    I’ve tried this code:

    <a rel="fancybox" href="<?php $thumbnail_id=get_the_post_thumbnail($post->ID); preg_match ('/src="(.*)" class/',$thumbnail_id,$link); echo $link[1];
    ?>"><?php the_post_thumbnail('my-custom-image'); ?></a>

    But it only opens the thumbnail when the image is clicked.

    Any tips?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Post Thumnbail URL’ is closed to new replies.