Logo Pupungbp.com

Need a WordPress expert help?

Featured Image as Previous Next Post Navigation in WordPress

Last Updated: June 27, 2020 | Reading Time: < 1 minute

Just add this code to single.php, replace or comment the default function like the_post_navigation, get_previous_post, get_next_post, etc.

$prev_post = get_previous_post();
$prev_thumbnail = get_the_post_thumbnail( $prev_post->ID, 'large');

$next_post = get_next_post();
$next_thumbnail = get_the_post_thumbnail( $next_post->ID, 'large');

$args = array(
'prev_text'  => $prev_thumbnail,
'next_text'  => $next_thumbnail
);

the_post_navigation( $args );

Easy!

Looking for an affordable WordPress solution?

We offer budget-friendly WordPress website development services to meet your needs. Prices start at $10.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.