1

Is there a simple way to use the post thumbnail when calling previous_post_link() and next_post_link()?

8

This could be acheived by using the get_previous_post() and get_the_post_thumbnail() functions. Then just pass the thumbnail value into the second parameter of previous_post_link().

$prevPost = get_previous_post();
$prevThumbnail = get_the_post_thumbnail( $prevPost->ID );
previous_post_link( '%link', $prevThumbnail );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.