WordPress.org

Forums

Linkable Custom Field Image (3 posts)

  1. chea24
    Member
    Posted 2 years ago #

    This is the code... I think. So there would be 2 custom fields to create the linkable image. I would add this code to my php file. What I don't get is where do I place the url to the image stored on my site?

    <?php if( get_post_meta($post->ID, "img", true) ): ?>
    
    <p><a href="<?php echo get_post_meta($post->ID, "imglink", true); ?>"><img src="<?php echo get_post_meta($post->ID, "img", true); ?>"></a></p>
    
    <?php endif; ?>
  2. Abhishek Ghosh
    Member
    Posted 2 years ago #

  3. chea24
    Member
    Posted 2 years ago #

    I checked that before but I have no idea what any of that means.

    Basically I have a Youtube image stored on my site. It's a small youtube logo. What I want to do is have it so when I enter the youtube url into the custom field value the outcome would be the youtube image that links to the youtube video.

    I always hit a brick wall with custom fields. I have very limited experience with code too.

Topic Closed

This topic has been closed to new replies.

About this Topic