• Resolved kingman33

    (@kingman33)


    Hi,

    I have added a “button” (image) in my template files so that an image appears in every single blog post. However, I would like to have this image link to a different website using custom field. I created a custom field called “link” and for the value i have been entering a url. However, what php code do I need to paste in the blog page file ? I have tried the following (the image is “playbutton.jpg” and it is automatically appearing in every post… I am trying to pull the ‘link’ URL from custom fields. THANKS

    < a href=”<?php echo get_post_meta( $post_id, ‘link’, true ); ?>”>
    <img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/playbutton.jpg”>

    Thanks in advance. Also, I have no PHP background.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘using custom field to link to an image in every post’ is closed to new replies.