Title: Custom Fields
Last modified: August 18, 2016

---

# Custom Fields

 *  [peiqinglong](https://wordpress.org/support/users/peiqinglong/)
 * (@peiqinglong)
 * [19 years ago](https://wordpress.org/support/topic/custom-fields-4-2/)
 * I’ve been having hell trying to figure this out. I’m trying to code it so that
   when no Custom Field is used, nothing related to Custom Field appears.
 * This is what I’m using to no avail:
 * `<?php if (function_exists('get_post_meta')) echo "<p><img src=\""; bloginfo('
   stylesheet_directory'); echo "/img/video_icon.gif\" alt=\"Video\" /> <a href=\"";
   echo get_post_meta($post->ID, "Video", true); echo "\" title=\""; echo get_post_meta(
   $post->ID, "Video", true); echo "\">Watch The Video</a></p>"; ?>`

Viewing 1 replies (of 1 total)

 *  [eliotc](https://wordpress.org/support/users/eliotc/)
 * (@eliotc)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/custom-fields-4-2/#post-600987)
 * look for the $value of the custom field instead…
 * so if you instead of: if (function_exists(‘get_post_meta)
    use: if ($value)
 * this will also help avoid problems if the users selects a custom field but doesn’t
   enter a value.

Viewing 1 replies (of 1 total)

The topic ‘Custom Fields’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [eliotc](https://wordpress.org/support/users/eliotc/)
 * Last activity: [18 years, 9 months ago](https://wordpress.org/support/topic/custom-fields-4-2/#post-600987)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
