Add a "Next Post" & "Previous Post" styled button manually to a post

Can anyone walk me through the exact steps?

I want to create two buttons that sit next to each other at the bottom of a post for the NEXT and PREVIOUS posts...I want to be able to insert this manually (html), and using a style/class to do it.

I'm assuming I have to do something in the functions.php file first? Then create a custom CSS button? Then add the code in the bottom of my post?

Topic next previous php css Wordpress

Category Web


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.