Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Faster WordPress Hosting: An Experiment for the Best Load Time (79ms). SEE HOW

Create Your Very Own WordPress Responsive Website Based on Bootstrap 3

Updated on February 19, 2017

7 Min Read
wordpress bootstrap
Reading Time: 7 minutes

What is a Responsive Theme?

With so many devices with different resolutions, screen sizes, and operating systems available in the market, the need for responsive websites and applications has become essential for anyone building an online presence.

Web developers, marketers, and designers from around the world know that there is a huge potential if your website is responsive and can be viewed, navigated, and browsed through easily on any device, whether mobile or desktop regardless of any resolution and aspect ratio.

Responsive Website Preview

Responsive themes are an approach to web designing in which elements of a website self-adjust according to screen sizes and browsers for better readability, user-experience, and load time. Developers and theme designers are cashing in on the concept of responsive websites.

Back in November 2013, Matt Cutts, the head of Google’s webspam team, released a video explaining that responsive design won’t negatively affect you in the SERPs. Further, Google has also published its guideline on mobile-friendly websites that contains details in entirety about how Google treats responsive websites.

As more and more smartphones, tablets, and other mobile devices are made available to the public, the use of desktops and laptops has seen a declining trend. This means people are using their smartphones to search just about anything: from news to local stores, from flight inquiries to the latest movies. This rising trend presents a big business opportunity for the online community.

Learn how to create a custom page template in WordPress that is also compatible with custom content types like Site Map, Contact Forms, About Us, etc.

WordPress and Responsive Web

WordPress is the most popular CMS that is used by a whopping 27% of websites on the Internet. It enjoys support from a strong community of open-source developers and designers coming from all walks of life. With whopping of the responsive web, most renowned theme developers adapted to responsive designs and introduced easy-to-understand frameworks, like Redux Framework, Carrington Core, Bootstrap etc., that can be used to create a responsive WordPress theme from scratch.

So, what is this Bootstrap?

Bootstrap is a toolkit that helps in the development of complex web applications. It was developed by developers at Twitter and was made available to the open-source community. Bootstrap is lightweight as it is coded in LessCSS.

Now, let’s get to work!

There are only the following 8 steps involved to create a WordPress Responsive site based on Bootstrap 3.

To go through this tutorial, you need to have a working knowledge of  the following things:

  • How FTP and HTML works
  • How to edit, create and upload PHP files on your server
  • How to navigate around using WordPress admin dashboard

Step 1: Unpacking Bootstrap

  1. First of all, install WordPress on your domain.
  2. Then download and unzip Bootstrap from
  3. Once done, connect to your WordPress hosting server by using an FTP client like FileZilla.
  4. Navigate to wp-content > themes.
  5. Create a new folder in themes directory called BootSTheme and upload the contents of unzipped Bootstrap in this folder.
  6. Almost all of the WordPress installations contain the following files:
    • index.php
    • style.css
    • header.php
    • footer.php

Now, make 4 empty files using the filename given above.

Step 2: Configuring Bootstrap

Open style.css and paste the following code.

Theme Name: MyTheme
Theme URI:
Description: Mytheme Built on bootstrap
Author: Ahsan Parwez
Author URI:

These are basically comments that provide description and details about the theme. If you want, you can place your own comments too.

Step 3: Copying the Code

For this tutorial, we are not going to use all of the CSS and JS files provided in the bootstrap package, we are going to copy the bootstrap.min.css code into the style.css. Your style.css file should look like this.

style.css screenshot

Step 4: Setting up HTML Template

We need to have a basic HTML template to work with. You can use this HTML theme for your purpose.

WordPress has built-in functions get_header() and get_footer() that by default call the files header.php and footer.php respectively. What we are going to do is cut the HTML code from top till the first container div and paste it into our header.php file, after which the file should like the image given below.

Header php

The footer.php file will contain the rest of the code:

Footer php

If we activate this theme and load it on our website, we are not going to see anything yet, because index.php does not contain anything. To load header and footer, we are going to use WordPress built-in function to call these elements by pasting the following code in index.php:

<?php get_header(); ?>

<?php get_footer(); ?>

Now header and footer elements will load on our website, but we will get a basic page that is without any kind of styling.

Basic WordPress Page

Step 5: Setting the Header and the Footer

In the header.php file, we are going to import the Bootstrap stylesheet by using the WordPress function echo get_stylesheet_uri() (read more at WordPress Codex), this is going to import the style.css styling onto our website and we are going to see a top menu bar now.

Homepage view

But this is not all, the JavaScript features on our page will still not work, and we will not see any drop down menus. To enable this, we are going to import our js files by directly importing the file by URL in the footer.php. Paste the following code before the closing body tag.

<script src="../wp-content/themes/MyBSTheme/js/bootstrap.min.js"></script>

WordPress is known for its customization and plugins. To tell WordPress where to place the plugins hooks, we are going to paste <?php wp_head(); ?> and <?php wp_footer(); ?> in header.php and footer.php files. Also, to set dynamic titles of the website, we are going to use wp_title(); function in the header.php file between the <title> tags.

<title><?php wp_title(' | ',true,'right'); ></title>

The above code will call the title of the post separated by ‘|’ than the site name. The Boolean true will display the title. If you set it to false, it will just return the value and not display it. ‘right’ defines the location of the post title to be right of the separator.

Managed WordPress Hosting on Optimized Cloud Servers

Step 6: Displaying the Featured Posts

Now, we are going to call posts dynamically onto our homepage index.php displayed on top, just like featured posts that we see on many WordPress powered sites.

Write the following code into your index.php:



while(have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><?php the_excerpt(); ?></p>

<?php endwhile; wp_reset_query(); ?>

We are going to use the while loop and set the number of posts to one by using post_per_page, this piece of code will only display the latest blog post on top of the page, and after the loop is closed, the query_posts resets.

The class jumbotron is defined in our bootstrap.min.css file. We are going to use it to style our featured posts by using <h2> tags and the_permalink(); function. The hyperlink is created on the post title, and the_permalink(); function links to the URL of the entire post. To show an excerpt of the post, we can use another built-in WordPress function that is the_excerpt();

Homepage View

Step 7: Listing Your Categories

Next, we are going to list our categories on the left of the homepage. We will do this by creating many instances of div styled with the classes of bootstrap and by WordPress function wp_list_categories();.

Paste the following code:

<div class="panel panel-default panel-body">

<?php wp_list_categories('orderby=name&title_li='); ?>


This will list the categories by name with a nice hover effect.

Step 8: Display the Latest Posts and Authors

Finally, we are going to show latest blog posts on the homepage. We are going to start another div tag and under this div, we will use similar while loop technique that we used in the featured post, but we are not going to limit it with query_posts();.


<?php while(have_posts()) : the_post(); ?>

<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_excerpt(); ?></p>
<p> posted by <?php the_author(); ?>

<?php endwhile; wp_reset_query(); ?>


WordPress functions the_author(); and fetch the username of the author of the post. We can use it to dynamically display the name of the author with every post.

Finalized Homepage

Once you have complete everything successfully, you will have a page like the one you see in the image shown above.

What’s next?

This tutorial is mainly focused on creating a basic WordPress theme from an HTML template and make it responsive by using Bootstrap 3.x. In future posts, we are going to make more pages like single.php, front-page.php, and functions.php. I will explain how to import stylesheets and JavaScripts from the functions.php file.

[You may want to read: 5 Spectacular Plug-Ins For Making WordPress Websites Mobile Responsive]

Quicker WordPress With Cloudways

WordPress, itself being search engine friendly, can really benefit from responsive design. At Cloudways, we believe in delivering ultimate performance. Our Cloud Platform allows you to launch secure WordPress servers within minutes. Your website will be hosted on a highly optimized stack of Apache+Nginx+Memcached+Varnish that cuts load times substantially.

Share your opinion in the comment section. COMMENT NOW

Ahsan Parwez

Ahsan is the Community Team Manager at Cloudways - A Managed Cloud Hosting Platform. He loves to solve problems and help Cloudways' clients in any aspect he can. In his free time, you can find him playing RTS PC games.

Start Growing with Cloudways Today!

We never compromise on performance, security, and support.

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!