Skip to content

Instantly share code, notes, and snippets.

@yumyo
Last active December 29, 2015 13:38
Show Gist options
  • Save yumyo/7678126 to your computer and use it in GitHub Desktop.
Save yumyo/7678126 to your computer and use it in GitHub Desktop.
<?php
$prev_post = get_previous_post();
$id = $prev_post->ID;
$permalink = get_permalink( $id );
$next_post = get_next_post();
$nid = $next_post->ID;
$permalink = get_permalink($nid);
?>
<nav class="post-nav">
<span class="nav-previous col-lg-6"><?php previous_post_link( '%link', __( '', '' ) ); ?>
<h3>
<a href="<?php echo $permalink; ?>"><?php echo $prev_post->post_title; ?></a>
</h3>
<p>
<?php
echo wp_trim_words( $prev_post->post_content, $num_words = 26, $more = '<a href="#">Read all ;)</a>' );
?>
</p>
</span>
<span class="nav-next col-lg-6"><?php next_post_link( '%link', __( '', '' ) ); ?>
<h3>
<a href="<?php echo $permalink; ?>"><?php echo $next_post->post_title; ?></a>
</h3>
<p>
<?php
echo wp_trim_words( $next_post->post_content, $num_words = 26, $more = '<a href="#">Read all ;)</a>' );
?>
</p>
</span>
</nav>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment