Did you manage to do this?
I’m trying do do something similar but I don’t know how to call a post_object field in functions.php
Regards Pip
I’ve found this and it works fine. The field donations is a Post Object field and in functions.php I’ve added this code:
<?php
function my_post_object_result( $title, $post, $field, $post_id ) {
// load a custom field from this $object and show it in the $result
$page_views = get_field(‘achternaam’, $post->ID);
// append to title
$title .= ‘ [‘ . $page_views . ‘]’;
// return
return $title;
}
// filter for every field
add_filter(‘acf/fields/post_object/result’, ‘my_post_object_result’, 10, 4);
?>
One more question though.. when I fill in the field Donation I can only search on post_id, not on the custom field.
Any ideas?