Hi,
I use the following code for previous/next navigation in single posts.
add_filter( 'generate_post_navigation_args', function( $args ) {
if ( is_single() ) {
$prevPost = get_previous_post(true);
$prevThumbnail = isset( $prevPost ) ? get_the_post_thumbnail( $prevPost->ID ) : '';
$nextPost = get_next_post(true);
$nextThumbnail = isset( $nextPost ) ? get_the_post_thumbnail( $nextPost->ID ) : '';
$args['previous_format'] = '<div class="nav-previous">Previously:<br>' . $prevThumbnail . '<br><span class="prev" title="' . esc_attr__( 'Previous', 'generatepress' ) . '">%link</span></div>';
$args['next_format'] = '<div class="nav-next">Next:<br>' . $nextThumbnail . '<br><span class="next" title="' . esc_attr__( 'Next', 'generatepress' ) . '">%link</span></div>';
}
return $args;
} );
One thing eludes me: making the thumbnail clickable with the next/previous link. How can that function add it?