Forums

Checking Custom Fields (1 post)

  1. freshifreshy
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.