Home › Forums › Add-ons › Repeater Field › Browse in repeater for post object › Reply To: Browse in repeater for post object
I’ve found this
http://www.advancedcustomfields.com/resources/tutorials/customize-the-relationship-field-list-htm/
Would it be possible to hack that to display a date instead of an image?
(Using relationships instead of post objects, of course)
-answer: yes.
function my_acf_relationship_result( $html, $post )
{
// add an image to each result
$image = get_field('thumbnail', $post->ID);
$date = get_the_date();
if( $image )
{
$html = '<img src="' . $image['url'] . '" />' . $html;
}
return $html . ' ' . $date;
}
// acf/fields/relationship/result - filter for every field
add_filter('acf/fields/relationship/result', 'my_acf_relationship_result', 10, 2);
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.