I hope this is the right section!
I have created a Custom Post Type and Custom Meta Box with a number of fields inside. I am currently able to display the information from the Custom Meta Box fields on the front end of the site, but am struggling with two things.
The first thing I want to do is to display the titles/labels of the fields within the Meta Box and secondly, I only want to display this information if there is actually something entered into the fields.
I hope someone can help!
The code I am using in my template is as follows:
<div id="field_1" class="meta_field_box"> <?php $field_1 = get_post_meta($post->ID, "custom_field_1", true); echo $field_1; ?> </div> <div class="clear"></div> <div id="field_2" class="meta_field_box"> <?php $field_2 = get_post_meta($post->ID, "custom_field_2", true); echo $field_2;?> </div> <div class="clear"></div>
Any articles I find on this seems to just focus on either amending the title names in the backend or displaying just the field information.