To be used on single post, the snippet below will not output unnecessary markup if there’s:
- only 1 published post.
- no post that is adjacent (previous or next) to current post.
<?php php if ( get_adjacent_post( false, '', false ) || get_adjacent_post( false, '', true ) ) : ?>
<div class="navigation">
<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">←</span> %title' ); ?>
<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">→</span>' ); ?>
</div>
<?php endif; ?>