{if !$location} {var $location = ''} {/if}

{if $wp->isAttachment}

	{if $wp->hasPreviousPost}
	<nav class="nav-single {$location}" role="navigation">
		{capture $prev}{!_x '%s Return to entry', '' |printf: '<span class="meta-nav">&larr;</span>'}{/capture}
		<span class="nav-previous">{prevPostLink $prev}</span>
	</nav>
	{/if}

{elseif $wp->isSingle}

	{if $wp->hasPreviousPost or $wp->hasNextPost}
	<nav class="nav-single {$location}" role="navigation">
		{if $wp->hasPreviousPost}
			{capture $prev}{!_x '%s', 'previous post' |printf: '<span class="meta-nav">&larr;</span>'}{/capture}
			<span class="nav-previous">{prevPostLink $prev}</span>
		{/if}

		{if $wp->hasNextPost}
			{capture $next}{!_x '%s', 'next post' |printf: '<span class="meta-nav">&rarr;</span>'}{/capture}
			<span class="nav-next">{nextPostLink $next}</span>
		{/if}
	</nav>
	{/if}

{elseif !$wp->isSingular}

	{if $wp->willPaginate}
	<nav class="nav-pagination" role="navigation">
		{if $wp->hasPreviousPosts}
			{capture $prev}{!__ '' |printf: '<span class="meta-nav">&larr;</span>'}{/capture}
			<span class="nav-previous">{prevPostsLink $prev}</span>
		{/if}

		{pagination}

		{if $wp->hasNextPosts}
			{capture $next}{!__ '' |printf: '<span class="meta-nav">&rarr;</span>'}{/capture}
			<span class="nav-next">{nextPostsLink $next}</span>
		{/if}
	</nav>
	{/if}

{else}
	{* fallback *}
	{if $wp->willPaginate}
	<nav class="nav-posts {$location}" role="navigation">
		{capture $prev}{!__ '%s' |printf: '<span class="meta-nav">&larr;</span>'}{/capture}
		{capture $next}{!__ '%s' |printf: '<span class="meta-nav">&rarr;</span>'}{/capture}

		<span class="nav-previous">{prevPostsLink $prev}</span>
		<span class="nav-next">{nextPostsLink $next}</span>
	</nav>
	{/if}
{/if}