Skip to content

Get adjacent items

dawnbuie edited this page Mar 9, 2013 · 7 revisions

The get_adjacent_items() gets links to previous, next sibling items and parent items

<?php
$items = p2p_type( $connection_type)->get_adjacent_items( $episode_id );

echo '<br> parent: '. get_permalink( $items['parent'] ); 

if ( $items['previous'] )
echo '<br> previous: ' . get_permalink( $items['previous'] );

if ( $items['next'] )
echo '<br> next: ' . get_permalink( $items['next'] );
?>
Clone this wiki locally