scribu, thanks for the quick response! Sorry for my delayed one. I reread the wiki article on Related Posts -- the wiki has been invaluable in using p2p -- and tried it again, but it still only returns the project that I am viewing (although there are shared people with other projects).
The connection type is:
global $projects_to_people_connection;
$projects_to_people_connection = p2p_register_connection_type( array(
'from' => 'projects',
'to' => array('people'),
'context' => 'side',
'sortable' => '_order',
'prevent_duplicates' => true,
'title' => 'Project Members',
'fields' => array(
'project_lead' => array(
'title' => 'Project Lead',
'values' => array(
'1' => 'Lead',
'0' => ''
)
),
'project_contact' => array(
'title' => 'Project Contact',
'values' => array(
'1' => 'Contact',
'0' => ''
)
)
)
) );
The related posts function is:
function get_project_associated_people( $post_id ) {
global $projects_to_people_connection;
$related_pages = $projects_to_people_connection->get_connected( $post_id );
if ( !$related_pages->have_posts() )
return array();
$page_id = $related_pages->posts[0]->ID;
return $projects_to_people_connection->get_connected( $page_id, array(
'post__not_in' => array( $post_id ),
) );
}
And the call is:
<?php global $get_project_associated_people; ?>
<aside>
<h2>Related Projects via get_project_associated_people</h2>
<?php p2p_list_posts(get_project_associated_people( get_queried_object_id() )) ?>
<figure>
<?php if ( has_post_thumbnail()) :?>
<a href="<?php get_permalink(); ?>" title="<?php the_title_attribute('echo=0');?>" >
<?php clean_wp_width_height(get_the_post_thumbnail(get_the_ID(),'large'));
<figcaption><?php the_title_attribute(); ?></figcaption>
</a>
</figure>
<?php wp_reset_postdata();?>
</aside>
Again, I have no problem returning the people associated with the project, or getting the metadata assigning the lead or contact to people, but the call above just returns the project itself.