Howdy. Been testing relationship fields and have stumbled a bit.
Use case:
I’ve got a custom post type ‘workshop’ and I made the posts available on the user edit screen as a relationship which works:
piklist('field', array(
'type' => 'select'
,'field' => 'user_relate_post'
,'label' => __('Relate Posts', 'piklist-demo')
,'attributes' => array(
'multiple' => 'multiple' // Allow a select field to accept multiple selections
)
,'choices' => piklist(
get_posts(array(
'post_type' => 'workshop'
,'numberposts' => -1
,'orderby' => 'title'
,'order' => 'ASC'
))
,array('ID', 'post_title')
)
,'relate' => array(
'scope' => 'post'
)
));
What I’d like to do now is display all users for a specific workshop. For example if a few users have ‘workshop 101’ selected on their pages -> show those users on the ‘workshop 101’ page. And vice versa.
I’ve tried the basic functions but can’t seem to figure it out. Anyone have ideas? Is it possible?