get_adjacent_post fails when using custom post types in The Loop
-
Hi,
I’m trying to use get_adjacent_post to work with the loop, but it seems to fail when using custom post types. I’m using $query->set to include my CPTs in the loop. Found the method on Justin Tadlock’s site: https://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page .
Here’s my loop code:
<?php if(have_posts()) : while(have_posts()) : the_post(); $adjacent_post_next = get_adjacent_post(false,'',true) ; $adjacent_post_previous = get_adjacent_post(false,'',false) ; $post_next = $adjacent_post_next->ID; $post_previous = $adjacent_post_previous->ID; echo "Previous = ".$post_previous." Next = ".$post_next."<br />"; endwhile; endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_adjacent_post fails when using custom post types in The Loop’ is closed to new replies.