Skip to content

Instantly share code, notes, and snippets.

@projoomexperts
Created March 14, 2015 05:15
Show Gist options
  • Save projoomexperts/e63152d5d8f3264f5a47 to your computer and use it in GitHub Desktop.
Save projoomexperts/e63152d5d8f3264f5a47 to your computer and use it in GitHub Desktop.
Woocommerce next previous product with image thumbnail
<div class="next-prev-page">
<span class="inner">
<?php
$prevPost = get_previous_post();
$prevThumbnail = get_the_post_thumbnail($prevPost->ID, array(150,150) );
$prevLink = get_permalink( $prevPost->ID );
?>
<?php if($prevPost){ ?>
<a class="prev" href="<?php echo $prevLink; ?>">
<?php print_r($prevThumbnail);?>
<i class="icon-arrow4-left"></i>
</a>
<?php } ?>
<?php
$nextPost = get_next_post();
$nextLink = get_permalink( $nextPost->ID );
?>
<?php if($nextPost) { ?>
<a class="next" href="<?php echo $nextLink; ?>">
<i class="icon-arrow4-right"></i>
<?php
$nextThumbnail = get_the_post_thumbnail($nextPost->ID, array(150,150) );
print_r($nextThumbnail); ?>
</a>
<?php } ?>
</span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment