treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Link to image original with get_post_meta

  • Hi!,

    I have this code in wordpress where I´m calling an image with custom field, I need that this image has a link to the original image.


    <a href="#" class="product" ><img src="<?php echo get_post_meta($post->ID, 'image', true); ?>" width=300 height=224 alt="Producto" /></a>



    Anyone can help?.
    Thanks.

  • Anyone?
  • It sounds like you shouldn't be using a custom field. If you are going to use post_meta to get the full size image, why don't you use it to also get the thumbnail?
  • Hi again Doc,

    Can you tell me how to do it?.

    Thanks.
  • The solution was in front of my eyes:
    Will be like this:


    <a href="<?php echo get_post_meta($post->ID, 'image', true); ?>" class="product" ><img src="<?php echo get_post_meta($post->ID, 'image', true); ?>" width=300 height=224 alt="Producto" /></a>


    Hope this can help someone else.