public function format_value($value, $post_id, $field) { // bail early if no value if (empty($value)) { return $value; } // force value to array $value = acf_get_array($value); // convert values to int $value = array_map('intval', $value); // load posts if needed if ($field['return_format'] == 'object') { $value = ACF_API_Fields()->api->get_posts($field, array('include' => $value)); } // convert back from array if neccessary if (!$field['multiple']) { $value = array_shift($value); } // return value return $value; }
</div> <?php } ?> <div class="selection acf-cf"> <div class="choices"> <ul class="acf-bl list"></ul> </div> <div class="values"> <ul class="acf-bl list"> <?php if (!empty($field['value'])) { // get posts $remote_posts = ACF_API_Fields()->api->get_posts($field, array('include' => $field['value'])); // set choices if (!empty($remote_posts)) { foreach ($remote_posts as $remote_post) { ?> <li> <input type="hidden" name="<?php echo $field['name']; ?> []" value="<?php echo esc_attr($remote_post->id); ?> " /> <span data-id="<?php echo esc_attr($remote_post->id); ?>