'posts_to_artists', 'from' => 'post', 'to' => 'artist' ) ); } add_action( 'wp_loaded', 'connect_posts2artists' ); ?> 5, 'post_type' => array('artist'))); p2p_type( 'posts_to_artists' )->each_connected( $recentPosts ); while( $recentPosts->have_posts() ) : $recentPosts->the_post(); ?> //... // Display connected posts if ($post->connected) {echo '
This artist has got no connected news items yet
';}; foreach ( $post->connected as $post ) : setup_postdata( $post ); ?>