Created
April 19, 2020 08:25
-
-
Save prosantamazumder/2a667401586344732f8aacb0ba800c3c to your computer and use it in GitHub Desktop.
WordPress Get Next Post and Previous Post Link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-sm-12"> | |
<div class="theme-pagination"> | |
<ul class="list-inline text-center"> | |
<?php // if need post next previous | |
$prev_post = get_previous_post(); | |
$id = $prev_post->ID ; | |
$permalink = get_permalink( $id ); | |
?> | |
<?php | |
$next_post = get_next_post(); | |
$nid = $next_post->ID ; | |
$permalink = get_permalink($nid); | |
?> | |
<li class="pull-left"><?php previous_post_link( '%link', __('<i class="fa fa-arrow-left" aria-hidden="true"></i>', 'mywebsite' ) ); ?> | |
</li> | |
<li class="pull-right"><?php next_post_link( '%link', __( '<i class="fa fa-arrow-right"></i>', 'mywebsite' ) ); ?> | |
</li> | |
</ul> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment