P
P
PavelScron2017-03-11 18:32:56
WordPress
PavelScron, 2017-03-11 18:32:56

Advanced Custom Fields - how to display the field name?

Advanced Custom Fields plugin.
I understand how to display the field value in the template, but I can’t find in the manuals how to display the name of the field itself before that.
Those. you have to conclude like this.
Field name - its data

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zorca, 2017-03-11
@PavelScron

Get the field object and select the field name from it: https://www.advancedcustomfields.com/resources/get...

<?php
$field_name = "text_field";
$field = get_field_object($field_name);

echo $field['label'] . ': ' . $field['value'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question