I've been successful in using the following code to display thumbnails for next & previous links for normal posts but this does not work at all for custom post types.
<div id="cooler-nav" class="navigation">
<?php $prevPost = get_previous_post(true);
if($prevPost) {?>
<div class="nav-box previous">
<?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, 'tiny_thumb' );?>
<?php previous_post_link('%link',"$prevthumbnail <p>%title</p>", TRUE); ?>
</div>
<?php } $nextPost = get_next_post(true);
if($nextPost) { ?>
<div class="nav-box next">
<?php $nextthumbnail = get_the_post_thumbnail($nextPost->ID, 'tiny_thumb' ); } ?>
<?php next_post_link('%link',"$nextthumbnail <p>%title</p>", TRUE); ?>
</div>
<?php ?>
</div><!--#cooler-nav div -->
I'm guessing it must be a special query to look for my custom post type "portfolio"
Any help would be greatly appreciated
EDIT<nav class="clearer">
<?php if( $prev_post = get_previous_post() ): ?>
<?php echo $prev_post->ID ?>
<div class="nav-box previous">
<?php $prevthumbnail = get_the_post_thumbnail($prev_post->ID, 'tiny_thumb' );?>
<?php previous_post_link('%link',"$prevthumbnail <p>%title</p>", TRUE); ?>
</div>
<?php endif; ?>
<?php if( $next_post = get_next_post() ): ?>
<?php echo $next_post->ID ?>
<div class="nav-box next">
<?php $nextthumbnail = get_the_post_thumbnail($next_post->ID, 'tiny_thumb' ); ?>
<?php next_post_link('%link',"$nextthumbnail <p>%title</p>", TRUE); ?>
</div>
<?php endif; ?>
</nav>
Other loop not working (I am getting thumbnails & links but no exclusion of current post or randomizing of order)
<?php
$t_args = array (
'tax_query' => array (
array (
'orderby' => 'rand',
'post_type' => 'portfolio',
'taxonomy' => 'service',
'field' => 'slug',
'terms' => $service_type,
'post__not_in' => array($post->ID)
)
)
);
$query = new WP_Query( $t_args );
if( $query->have_posts() ) {
while ( $query->have_posts() ) : $query->the_post();
// output your stuff
echo '<div class="more_from_thumb"><a href="';
the_permalink();
echo '">';
the_post_thumbnail();
echo '</a></div>';
endwhile;
wp_reset_query();
} ?>