Next / Previous Post using Post Thumbnail?
-
I am using this code on my blog for the moment:
<div id="cooler-nav" class="navigation"> <?php $prevPost = get_previous_post(true); if($prevPost) {?> <div class="nav-box previous" style="float:left;"> <?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(100,100) );}?> <?php previous_post_link('%link',"$prevthumbnail %title", TRUE); ?> </div> <?php $nextPost = get_next_post(true); if($nextPost) { ?> <div class="nav-box next" style="float:right;"> <?php $nextthumbnail = get_the_post_thumbnail($nextPost->ID, array(100,100) ); } ?> <?php next_post_link('%link',"$nextthumbnail %title", TRUE); ?> </div> </div><!--#cooler-nav div -->
The result can be found on this page: https://funny-pictures-blog.com/2011/03/24/in-soviet-russia-pictures/
The problem is that it does not work with videos. so if a video is dispalyed on the blog post only, it ONLY shows the next video post, and that can be posted a few weeks before. Is there any code that i can use that shows both videos and thumbnails. so if a video post have no image, it will use a default thumbnail or something like that.
An example on how a video post looks like: https://funny-pictures-blog.com/2011/03/24/funny-videos-funny-bird/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Next / Previous Post using Post Thumbnail?’ is closed to new replies.