How to Add a Back and Forward Button in a WordPress Website

It’s no secret that using a CMS (content management system) to build a website has revolutionized the way people create and consume content online. (You can learn more about Content Management Systems in my guide to mastering content marketing: [Blog article]:

Mastering Content Marketing

With a CMS, the amount of work needed to get a website up and running is drastically reduced, which means you can get back to focusing on content rather than HTML. (HTML stands for Hypertext Markup Language and is what websites are built on top of.)

Since its inception, WordPress (owned by Automattic, Inc) has been the most popular content management system in the world, with an estimated 300 million active monthly users and counting. (According to WordPress)

One of the most prominent features of WordPress is the built-in forward and back buttons that appear at the end of each post. These buttons allow users to navigate through your content easily using only their keyboard. (And yes, they do still exist in Facebook’s source code as of v3.5.)

But navigating through content on a keyboard is only one use case for these buttons. In the real world, people often want to be able to forward a specific email they’ve received or get back to a blog post they’ve previously read. (And if you’re anything like me, you’ll want to keep track of what you’ve read so you don’t have to worry about forgetting important details when you return to a piece of content.)

Thankfully, with a few lines of code, you can add a back and forward button to your WordPress website, which will enable you to do just that.

How to Add a Back and Forward Button in a WordPress Website

So, you’ve decided to add a back and forward button to your website. Great!

It’s important to note here that in addition to adding a back and forward button to your website, you are also customizing the look of your website’s archive (aka “the blog”). (The blog is where you can find all your recent blog posts and is the default location that WordPress uses when you go to browse content on your site.)

So you’re going to be recreating part of WordPress’ default look with your own customizations. For this reason, we will walk you through the process of adding the back and forward button to your blog before moving on to the next step.

Step 1: Create a static HTML page and upload it to your website

First things first. You need a place to display your blog posts, and the best (and perhaps the only) place for that is a static HTML (Hypertext Markup Language) page. (HTML stands for Hypertext Markup Language and is what websites are built on top of.)

An HTML page is a flat file that contains only text and elements made with HTML codes. So, if you have a template for your blog posts, you can use that as a starting point for your static HTML page. (A static HTML page doesn’t get updated when the content is changed. So, while it may not seem like a huge deal, making sure your code is error free is essential before continuing.)

If you’re using WordPress itself to create your blog, you’ll find the option to make a static page under the Settings > Reading section of your WordPress dashboard. (If you’re not using WordPress itself to create your blog, you can still use a static HTML page to host your content. You’ll find instructions for configuring Squarespace as a static page here.)

Make sure to take the time to read the comments left by previous users in case you encounter any errors. The more comments you have, the more likely you are to run into an issue.

Step 2: Navigate to your website’s URL and append /blog to it

Now that you have a static HTML page with your blog post’s content on it, you can prepend that URL with either /blog or not. (You can read more about the difference between /blog and \ at https://en.wikipedia.org/wiki/Category:Blogs.)

If you go with the /blog route, you will be adding this to the end of your URL whenever you want to access your blog posts. So, let’s say you want to return to a specific blog post you’ve previously read. You would go to mywebsite.com/blog/post-title to read it. (The \ at the beginning of your URL indicates that you are going to be adding a category or tag to the end. So, if you want to add a category or tag to your blog post’s content, you would type mywebsite.com/blog/category/tagged.)

Appending /blog to your website’s URL makes it easier for users to find your blog posts. (Appending /blog to your URL also makes it easier for search engines to find and list your blog posts in search results.) If you’ve ever visited another person’s blog, you might have recognized the common theme — all their URLs begin with /blog/.)

Step 3: Style your blog’s archive with CSS (Cascading Style Sheets)

After you’ve prepended your URL with /blog, you can style it with CSS (Cascading Style Sheets). CSS is a style sheet language that enables you to easily format and style the different elements on your blog. (Think of a style sheet as a blueprint for your blog post’s appearance.)

To learn more about CSS and how to use it, check out these helpful tutorials:

  • How to Create a Basic CSS Theme for Your Blogger Blog
  • How to Customize the WordPress Blogger Theme
  • How to Make a Grid Layout with CSS
  • CSS and Email Marketing: Setting Up a MailChimp Campaign Using CSS

As you can see, many of these tutorials focus on the aesthetics of your blog’s content — making sure the different elements you’ve styled with CSS fit the overall vision you have for your blog. But don’t be afraid to use CSS to make functional changes to your blog as well.

You can use CSS to

  • Add a background image to a div
  • Style your blog’s header
  • Style your blog’s sidebar
  • Style your blog’s footer
  • Apply a border to your blog’s content (div)
  • Make text larger or smaller
  • Change the color of certain elements on your blog
  • Add a button to a blog post’s content (div)
  • And much more…

So, as you can see, using CSS to style your blog’s archive is a great way to make it functional as well as attractive. (And remember, you’re free to use as many CSS classes as you want — it’s great for organization!)

Step 4: Include the WordPress navigation menu with your blog’s posts

In addition to creating a static HTML page and uploading it to your website, you’re also going to be including the WordPress navigation menu with your blog posts. (The navigation menu is what appears when you click on the small word “Menu” at the top of your browser window.)

The WordPress navigation menu is extremely versatile and includes a lot of useful features. For instance, if you’ve uploaded a photo to one of your blog posts, you can click on the photo’s associated link to navigate to that post. You can also click on the Blog link itself to see your blog’s posts in chronological order. (You don’t have to have photos associated with your blog posts to be able to use the WordPress navigation menu — any content with an assigned photo will automatically appear in the menu when you add it to your site.)

To add the WordPress navigation menu to your blog’s archive, you can either go the easy route and add the Menu item to the end of your URL (as we did in Step 2), or you can go the extra mile and prepend your URL with either /forum or /wiki. (If you’re using a subdomain rather than a main domain, simply replace the \ with / in your prepended URL.)