I have a CPT called Movies and Episode List. I create a movie called "Paranormal Activity" and I create "episode 1", "episode 2", "episode 3", "episode 4". I connect each of them to "Paranormal Activity" with plugin post 2 posts by scribu. I have follow the tutorials here posts 2 posts support forum its still don't work.
It's shown at http://localhost/movie/conor ( what I called "Paranormal Activity") and this is the code what I have tested:
$episode_id = get_the_ID();
$prev = p2p_type( 'posts_to_pages' )->get_adjacent_items( $episode_id );
$next = p2p_type( 'posts_to_pages' )->get_adjacent_items( $movie_id, $episode_id );
$items = p2p_type( 'posts_to_pages' )->get_adjacent_items( $episode_id );
echo get_permalink( $items['parent'] );
if ( $items['previous'] )
echo 'previous: ' . get_permalink( $items['previous'] );
if ( $items['next'] )
echo 'next: ' . get_permalink( $items['next'] );