Skip to content

Instantly share code, notes, and snippets.

@Jursdotme
Last active August 29, 2015 14:09
Show Gist options
  • Save Jursdotme/4aed1d11d2ad5f4759f8 to your computer and use it in GitHub Desktop.
Save Jursdotme/4aed1d11d2ad5f4759f8 to your computer and use it in GitHub Desktop.
Add custom field to Relationship field output
<?php function my_acf_relationship_result( $html, $post )
{
// add an image to each result
$field = get_field('varenummer', $post->ID);
if( $field )
{
$html = '<strong>' . $field . '</strong> - ' . $html;
}
return $html;
}
// acf/fields/relationship/result - filter for every field
add_filter('acf/fields/relationship/result', 'my_acf_relationship_result', 10, 2); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment