Wordpress get next previous post link



Here is the code for previous post

<?php
 $prev_post = get_previous_post();
 if (!empty( $prev_post )): ?>
 <a href="<?php echo $prev_post->guid ?>" class="previous">
  <i class="fa fa-angle-double-left" aria-hidden="true"></i>Previous
 </a>
<?php endif ?>


Here is the code for next post

<?php
 $next_post = get_next_post();
 if (!empty( $next_post )): ?>
 <a href="<?php echo $next_post->guid ?>" class="next">Next
  <i class="fa fa-angle-double-right" aria-hidden="true"></i>
 </a>
<?php endif ?> 





Related Post


Latest Post


Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.