phprockers-logo

How to get the next and Previous title link for current post in wordpress?

<div id="posts_navigation">
    //get the previous link for current page
    <?php if(get_adjacent_post(true, '', false)) { ?>
    <div class="next"><?php next_post_link('%link', '%title', TRUE, '');?></div>
    <span> | </span>
    <?php } ?>
    //get the next link for current page
    <?php if(get_adjacent_post(true, '', true)) { ?>
    <div class="prev"><?php previous_post_link('%link', '%title', TRUE, '');?></div>
    <?php } ?>
</div>

0 comments:

Post a Comment