Show custom field only if populated Wordpress


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php $FIELDNAME = get_post_meta($post->ID, 'FIELDNAME', true);
  2.  
  3. if($FIELDNAME) : ?>
  4.  
  5. <a title="Click Here To Purchase Tickets" href="<?php get_custom_field_value('FIELDNAME', true) ?>" rel="bookmark">PURCHASE TIX</a>
  6.  
  7. <?php endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.