Support

Account

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);