Skip to content

p2p_distribute_connected

scribu edited this page Apr 7, 2013 · 4 revisions

If each_connected() seems confusing, you can do it yourself:

$connected = new WP_Query( array(
  'connected_type' => 'YOUR-CONNECTION-TYPE',
  'connected_items' => $wp_query->posts,
  'nopaging' => true
) );

p2p_distribute_connected( $wp_query->posts, $connected->posts, 'connected' );

For each element in $wp_query->posts, it will create a sub-array with the relevant elements from $connected->posts; this sub-array will be accessible via $post->connected.