Support » Fixing WordPress » how to have images AND links in same custom field?

  • Resolved mixmastermichael

    (@mixmastermichael)


    Hi there, so I successfully know how to add IMAGES as a custom field for a page template, and also how to add LINKS as a custom field on a page template… but, how do I have a custom field so that the IMAGE LINKS to whatever I want to add in the custom field???

    Please let me know if that does not make sense. I am happy to clarify.

    Thanks for any help.
    Miike

Viewing 3 replies - 1 through 3 (of 3 total)
  • I am assuming that you are putting the URL of an image in your Custom Field. If that is correct, you could have code like this in your template:

    $image = get_post_meta($post->ID,'image-url',true);
    echo "<a href='$image' title='Link to $image'><img src='$image' alt='Link to image' /></a>";

    thanks for the reply… got me on the right track 🙂

    If your problem has been solved, please use the dropdown on the right to mark this topic ‘Resolved’ so that anyone else with this question can see that there is a solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to have images AND links in same custom field?’ is closed to new replies.