Answer the question
In order to leave comments, you need to log in
How to display multiple images from different Advanced Custom Fields WP fields in one array?
Hello! Help display in one array of images. I work with the ACF Wordpress plugin, the margins for the images are different. In different arrays it turns out to deduce and in one I can not. Here's what's there:
<?php $fields_group = 9255;
$fields = get_field_objects();
$fields_sort = array();
if ($fields) {
foreach ($fields as $field_name => $field) {
if ((int)$field['field_group'] == $fields_group && $field['value'] != '') {
if (is_array($field['value'])) {
$field_value = implode(", ", $field['value']);
} else {
$field_value = $field['value'];
}
if ($field['class'] == 'text') {
$fields_sort[(int)$field['order_no']] =
"<div class="param"><div class="row"> <div class="col-md-4">" . $field['label'] . ":</div><div class="col-md-8"><b> " . $field_value . "</b></div></div></div>\r\n";
} elseif ($field['class'] == image) {
/* тут пытаюсь получить массив*/
/*$fields_sort[(int)$field['order_no']] =
"<div class="param"><div class="row"> <div class="col-md-4"></div><div class="col-md-8"></div></div></div>\r\n";
*/
} elseif ($field['class'] == select) {
$field_value_heigth = explode(",", $field_value);
$res = array();
foreach ($field_value_heigth as $value_h):
$res[] = "<option class = 'form_ord'>$value_h</option><br>";
endforeach;
$over = implode($res);
$fields_sort[(int)$field['order_no']] = "<div class="param"><div class="row"><div class="col-md-4">" . $field['label'] . ":</div><div class="col-md-8"><select>" . $over . "</select></div></div></div>\r\n";
}
}
}
ksort($fields_sort);
foreach ($fields_sort as $output) {
echo $output;
}
} ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question