Home › Forums › General Issues › Formatting Field Label › Reply To: Formatting Field Label
Thanks but I wanted the label wrapping in HTML not the value, also because you didn’t put your code in code tags when copying/pasting the quotes/apostrophes will be the wrong format.
I found this code which seems to work well:
<?php $field_name = "distance";
$field = get_field_object($field_name);?>
<?php if ($field['value']): ?>
<span class='post-meta-key'><?php echo $field['label']; ?>:</span> <?php echo $field['value']; ?>
<?php endif; ?>
Let me know if this is a good/bad solution.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.