Home › Forums › Front-end Issues › HowTo: show ALL acf fields and their labels › Reply To: HowTo: show ALL acf fields and their labels
damn it ^^. then one could use it that way:
<?php
if($fields = get_field_objects()){
unset($fields["bild"]);
unset($fields["asin"]);
unset($fields["preis"]);
unset($fields["bewertung"]);
unset($fields["produktname"]);
?>
<div class='data row'>
<?php
foreach($fields as $field){
?>
<div class='item col-sm-6 col-md-4 col-lg-3'>
<div class='term'>
<?php echo $field["label"];?>
</div>
<div class="value">
<?php
if(isset($field["prepend"])) echo $field["prepend"]." ";
if(isset($field["choices"])){
if(is_array($field["value"])){
$newarray = array();
foreach($field["value"] as $value){
$newarray[] = $field["choices"][$value];
}
echo implode(",",$newarray);
} else {
echo $field["choices"][$field["value"]];
}
} else {
echo $field["value"];
}
if(isset($field["append"])) echo " ".$field["append"];
?>
</div>
</div>
<?php
}
?>
</div>
<?php
}
?>
this will generate nice list with pre- and appended elements and will look for right labels for checkboxes/select fields
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.