Skip to content

Instantly share code, notes, and snippets.

@LinzardMac
Created May 7, 2013 20:35
Show Gist options
  • Select an option

  • Save LinzardMac/5535889 to your computer and use it in GitHub Desktop.

Select an option

Save LinzardMac/5535889 to your computer and use it in GitHub Desktop.
<?php
$referring_url = get_post_meta($post->ID, 'referring_url', true);
$referring_url_name = get_post_meta($post->ID, 'referring_url_name', true);
$downloads = get_post_meta($post->ID, 'download_location', true);
$downloads_name = get_post_meta($post->ID, 'download_name', true);
$contact = get_post_meta($post->ID, 'contact_name', true);
$contact_url = get_post_meta($post->ID, 'contact_url', true);
if(empty($referring_url) && empty($downloads) && empty($contact)){
//echo "foo!";
}else{
?>
<ul class="cta">
<?php
// check if the custom field has a value
if($referring_url != '') {
?>
<li><a href="<?php echo $referring_url; ?>" class="button url" rel="external" title="<?php echo $referring_url; ?>"><?php echo $referring_url_name; ?></a></li>
<?php }
// check if the custom field has a value
if($downloads != '') {
?>
<li><a href="<?php echo $downloads; ?>" class="button download" rel="external" title="<?php echo $downloads; ?>"><?php echo $downloads_name; ?></a></li>
<?php }
// check if the custom field has a value
if($contact != '') {
?>
<li><a href="<?php echo $contact_url; ?>" class="button contact" rel="external" title="<?php echo $contact; ?>"><?php echo $contact; ?></a></li>
<?php }
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment