The current Prev and Next buttons in a wordpress theme that I'm using is rendered from this function in functions.php:
if ( !function_exists( 'krunk_post_navigation' ) ) {
function krunk_post_navigation( $direction, $posting, $term ) {
$post_navigation = '';
if( $posting ) {
$post_navigation .= '<a class="post-navi-' . $direction . ' clearfix" href="' . get_permalink( $posting->ID ) . '">' .
'<div class="post-navi-inner">';
$post_navigation .= '<div class="post-navi-' . $direction . '-info">' .
'<div class="table-cell-middle">' .
'<div class="post-navi-label"><i class="fa fa-long-arrow-left"></i>' . esc_attr( $term ) . '<i class="fa fa-long-arrow-right"></i></div>' .
'</div>' .
'</div>' .
'</div>' .
'</a>';
}
return $post_navigation;
}
}
How do I integrate the following code to the function above so that there will be a thumbnail of the previous and next posts too along with the arrows?
$previousPost = get_previous_post();
$previousThumbnail = get_the_post_thumbnail( $previousPost->ID );
$nextPost = get_next_post();
$nextThumbnail = get_the_post_thumbnail( $nextPost->ID );