scribu/wp-posts-to-posts — Issue #39: Strange behaviour
Author: andrewmclagan
Created: 2011-10-27 04:58:06+00:00
State: open

i register my connection within my plugin like so
-----------------
// Make sure the Posts 2 Posts plugin is active.
if ( !function_exists( 'p2p_register_connection_type' ) )
return;

// register connection
p2p_register_connection_type( array(
'id'	=> 'organisation_to_program',
'from'	=> 'service_provider',
'to'	=> 'program'
) );

then i connect some posts through the admin interface... and call the posts like this
----------------
// Find connected posts
$connected = p2p_type( 'organisation_to_program' )->get_connected( $post->ID );

// Display connected posts
if ( $connected->have_posts() ) :
echo '

Related posts

';
p2p_list_posts( $connected );
endif;

* although no posts are displayed
* the connection box in the admin appears on the "service_provider" post type
* if i replace the $post->ID with the actually ID of a service provider it does not work
*ALTHOUGH.... and interestingly. if i put a ID of one of the "program" post types in the function it works... but show the single connected service post.... this seems teh opposite to what i want connections FROM service_provider TO programs ... one to many

i may have this wrong, I love this plugin! should be in the core...