Adding text prior to get_post_meta (displaying custom fields)
-
Hi guys, as you can see from this page:
https://www.neliti.com/etiology-of-acute-non-malaria-febrile-illnesses-in-jayapura-northeastern-papua-indonesia/It displays a whole bunch of custom fields. Take a look at the custom field “additional information”, it’s value is empty, but the writing “additional information” is still there. I coded it like so:
<b>Additional Information:</b> <?php echo get_post_meta($post->ID, 'Additional Information', true); ?>
With my code,
<b>Additional Information</b>
is coded in html, so it will always be seen whether the custom field value is filled or not! I’d like to make it so that<b>Additional Information</b>
is only seen when the custom field has a value. How can this be done? I’d imagine it can be done with the use of $str and echo within the php code.Thanks so much for any help ?? my site depends upon this answer.
- The topic ‘Adding text prior to get_post_meta (displaying custom fields)’ is closed to new replies.