I am using the below code to display thumbnail with next/prev posts links on single.php
page. It is working fine when next and prev post are from same category but not showing the next or prev post link if that one is from another category.
<!-- Pagination -->
<div id="post_pagination">
<?php $nextPost = get_next_post(true);
if($nextPost) {
$args = array(
'posts_per_page' => 1,
'in_same_cat' => false,
'include' => $nextPost->ID
);
$nextPost = get_posts($args);
foreach ($nextPost as $post) {
setup_postdata($post);
?>
<a href="<?php the_permalink(); ?>"><div class="post_next_post">
<?php the_post_thumbnail('thumbnail'); ?>
<span class="next">Next Story »</span>
<h4><?php the_title(); ?></h4>
</div></a>
<?php
wp_reset_postdata();
} //end foreach
} // end if
?>
<?php $prevPost = get_previous_post(true);
if($prevPost) {
$args = array(
'posts_per_page' => 1,
'in_same_cat ' => false,
'include' => $prevPost->ID
);
$prevPost = get_posts($args);
foreach ($prevPost as $post) {
setup_postdata($post);
?>
<a href="<?php the_permalink(); ?>"><div class="post_prev_post">
<?php the_post_thumbnail('thumbnail'); ?>
<span class="prev">« Previous Story</span>
<h4><?php the_title(); ?></h4>
</div></a>
<?php
wp_reset_postdata();
} //end foreach
} // end if
?>
</div>
<!-- Pagination -->
So how to make it working as normal next/prev post links works...???