Created
September 13, 2018 16:15
-
-
Save nfsarmento/543cd6930b11b0322a4c510135a839cd to your computer and use it in GitHub Desktop.
Next and previous post with post thumbnails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $prevPost = get_previous_post(); | |
$prevthumbnail = get_the_post_thumbnail($prevPost->ID,array(80,97)); ?> | |
<h2><?php previous_post_link('%link', 'Previous'); ?></h2> | |
<?php previous_post_link('%link', $prevthumbnail); ?> | |
<?php // Display the thumbnail of the next post ?> | |
<?php $nextPost = get_next_post(); | |
$nextthumbnail = get_the_post_thumbnail($nextPost->ID,array(80,97)); ?> | |
<h2><?php next_post_link('%link', 'Next'); ?></h2> | |
<?php next_post_link('%link', $nextthumbnail); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment