marko krstić

Collections

Archives

Add prev and next post with title and thumb

Add this in codeblock in single post template

<?php $prev = get_previous_post(); ?>

<a href="<?php echo get_permalink( $prev->ID ); ?>">

	<h3><?php echo apply_filters( 'the_title', $prev->post_title ); ?></h3>
	<?php echo get_the_post_thumbnail(
  		$prev->ID, 
  		'thumbnail',
  		array('class' => 'your-class-name')
	); ?>
  
</a>



<?php $next = get_next_post(); ?>

<a href="<?php echo get_permalink( $next->ID ); ?>">
	<h3><?php echo apply_filters( 'the_title', $next->post_title ); ?></h3>
	<?php echo get_the_post_thumbnail(
  		$next->ID, 
  		'thumbnail',
		array('class' => 'your-class-name')
	); ?>
</a>

Title is wrapped with h3 and thumbnail is having class ('your-class-name') that you can change to your needs.

Let's Connect

Feel free to reach out for collaborations or just a friendly hello ?
[email protected]
linkedininstagramdribbblefacebook-official