Support

Account

Home Forums Feature Requests Display relationship objects custom fields in relationship search Reply To: Display relationship objects custom fields in relationship search

  • Hi Elliot,

    thanks for your answer.
    I’m not an expert with jQuery, so by now I found this solution:
    In relationship.php I duplicated the featured_image code in the loop and added:

    if( in_array('code', $field['result_elements']) )
    {
    	$code = get_field( 'code' );
    				
    	$title .= '<span class="code">' . $code . '</span> ';
    }

    and then in right list:

    if( in_array('code', $field['result_elements']) )
    {
    	$code = get_field( 'codice', $p->ID );
    					
    	$title .= '<span class="code">' . $code . '</span> ';
    }

    and in the choices array I added:
    'code' => __("Code",'acf'),

    In this way it works perfectly (as shown in the screenshot).
    Is it possible to do the same with a hook or filter in functions.php, so I leave your file unchanged and update friendly?

    Regards,
    Davide