get_adjacent_items() not working correct.how do fix it?
-
<?php
function my_connection_types() {
p2p_register_connection_type( array(
‘name’ => ‘post_to_series’,
‘from’ => ‘post’,
‘to’ => ‘series’,
‘sortable’ => ‘any’, // this must be set to ‘any’ ortrue
‘cardinality’ => ‘many-to-one’, //optional
) );
}<?php
$items = p2p_type(‘posts_to_series’)->get_adjacent_items( $episode_id );
if ( $items[‘parent’] )
echo ‘
parent: ‘. get_permalink( $items[‘parent’] );if ( $items[‘previous’] )
echo ‘
previous: ‘ . get_permalink( $items[‘previous’] );if ( $items[‘next’] )
echo ‘
next: ‘ . get_permalink( $items[‘next’] );
?>I used this code in my website, but Previous and next not show. parent working good,how to fix it?
- The topic ‘get_adjacent_items() not working correct.how do fix it?’ is closed to new replies.