Support

Account

Home Forums Front-end Issues Field type: User (display format question)

Helping

Field type: User (display format question)

  • Hi, firstly let me apologise, my knowledge with code is appalling. (frontend designer normally!)

    I’m working with ACF pro, and need a little help. As there is no documentation to accompany field type: User. (and I’m a code numpty!)

    On a custom post type ‘users’ are selected (in this case exhibiting artists) and I need to display the ‘display_name’ as a link to their profiles. (bbMemebrs)

    post example: http://www.tandem5.co.uk/nba2/nba_venue/34-monmouth-road/

    code in custom post template:

    	<p> <span>Exhibiting artists&emsp;</span>
    		<span class='answer'>	<?php // artists ( array )
    $artists_array = get_field( 'artists' );
    if ( $artists_array ):
    	foreach ( $artists_array as $artists_item ):
    	 	echo $artists_item['display_name'];
    	endforeach;
    endif; ?></span></p>

    This does spit out the display name, but not in a format that i can style. Also I want the name to link to the user’s profiles.

    Any help or pointers would be greatly appreciated… learning on the job with a deadline is proving stressful!

    Thanks

  • There is a filter for altering the label acf/fields/user/result it works the same way as this one acf/fields/relationship/result https://www.advancedcustomfields.com/resources/acf-fields-relationship-result/ and also has the /name= and /key= alternates.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Field type: User (display format question)’ is closed to new replies.