Title: Checking Custom Fields
Last modified: August 19, 2016

---

# Checking Custom Fields

 *  [freshifreshy](https://wordpress.org/support/users/freshifreshy/)
 * (@freshifreshy)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/checking-custom-fields/)
 * I want to display a custom field only if it exists. I’m not exactly sure what
   happened because at one time I think I had it working, but now it won’t execute
   the “if” portion.
 *     ```
       <?php $key="clip"; if (get_post_meta($post->ID, $key, true)) {  ?>
   
       <?php c2c_get_recent_posts(4,'<div id="podcast" style="position: relative;"><table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td align="left" valign="top"><script type="text/javascript" src="http://www.jeroenwijering.com/embed/swfobject.js"></script>
   
       <div id="video"></div>
   
       <script type="text/javascript">
       var so = new SWFObject("http://www.sizzleinthemiddle.com/media_player/mediaplayer.swf","mpl","234","173","9");
       so.addParam("allowscriptaccess","always");
       so.addParam("allowfullscreen","false");
       so.addParam("flashvars","&file=%post_custom(clip)%");
       so.write("video");
       </script></td><td align="left" valign="top"><h2>%post_URL%</h2><small>%post_date(F jS, Y)%</small><p>%post_content_full%</p></td></tr></table></div>',4); ?>
   
       <?php } else { ?>
   
       <?php c2c_get_recent_posts(4,'<div id="podcast" style="position: relative;"><table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td align="left" valign="top"><img src="%post_custom(thumbnail)%"></td><td align="left" valign="top"><h2>%post_URL%</h2><small>%post_date(F jS, Y)%</small><p>%post_content_full%</p></td></tr></table></div>',4); ?>
   
       <?php } ?>
       ```
   
 * Any help figuring out what might have gone wrong would be greatly appreciated.

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [freshifreshy](https://wordpress.org/support/users/freshifreshy/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/checking-custom-fields/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
