This is standard WordPress functionality, contained in previous_post_link
and next_post_link
. You don’t need to edit functions.php
. Just add to your template:
<div class="buttons">
<span class="previous-button"><?php previous_post_link() ?></span>
<span class="next-button"><?php next_post_link() ?></span>
</div>
Now you can style the buttons with css
. Follow the codex links for customizing options to the functions.