Showing Thumbnail from Previous and Next Posts
-
16-10-2019 - |
문제
Is there a simple way to use the post thumbnail when calling previous_post_link()
and next_post_link()
?
해결책
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 );
제휴하지 않습니다 wordpress.stackexchange