• Resolved kimmi_baby

    (@kimmi_baby)


    Hi,
    I have the following code
    <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
    What I would like to do is turn the thumbnail into a link but I would like it to link to the website I assign when I upload the image through admin. Is this possible? How would I do this? Normally that link is the individual photo BUT I would like it to link to a website I assign myself. I would also like the link to have a target.

    Please help!

Viewing 11 replies - 1 through 11 (of 11 total)
  • In lower right of the new post admin screen (if not see upper right screen options), there should be a link to featured image (theme dependent)… use this to add a featured image and once the file is uploaded review the Link URL section and add your url, then save as featured image.

    Thread Starter kimmi_baby

    (@kimmi_baby)

    Hi,
    I’ve already added the feature image and the link this way but the thumbnail isn’t a link when I click on it. I’m thinking it’s something I need to add to <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?> So far nothing happens.

    you need to wrap it in:

    <a href="<?php the_permalink(); ?>"> <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?> </a>

    I think that’s how you do it, if not check here

    Thread Starter kimmi_baby

    (@kimmi_baby)

    It didn’t work… It just reloaded the same page…

    I think it depends on where you start and where you want it to go, you proably want it in your loop or index.php, what ever your blog page file is called, and not in single.php.

    check this thread

    Thread Starter kimmi_baby

    (@kimmi_baby)

    That seems to link the image to it’s post…

    Yes.

    What I would like to do is turn the thumbnail into a link but I would like it to link to the website I assign when I upload the image through admin.

    I don’t think you can do that, at least not easily

    You may have to not use featured images,and instead embed thumnails in the post so the custom image link settings will work.

    In lower right of the new post admin screen (if not see upper right screen options), there should be a link to featured image (theme dependent)… use this to add a featured image and once the file is uploaded review the Link URL section and add your url, then save as featured image.

    Let’s ignore this as improper replies that the OP would have had no time to test and prove. Please, think about my reply.

    Thread Starter kimmi_baby

    (@kimmi_baby)

    I did read your reply and there was no need to test it because that’s what I attempted before I posted on here. I did my research before I posted. It’s something in my theme that wouldn’t work.

    I found a different way to do it. Not ideal but works anyway.

    Sorry Swanson, I thought the OP tested your solution so you’re right,I didn’t try it. But I shall. Thanks.

    good enough for me, glad you resolved.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to link the feature image’ is closed to new replies.