Key Takeaways
- Essential theme files (
style.css,functions.php,header.php,index.php, andfooter.php) are the foundation of any WordPress theme. - Bootstrap is a powerful, open-source front-end framework that simplifies responsive design and provides a library of pre-built, reusable components.
- Proper asset management is critical for performance and reliability; instead of hard-coding links, use
functions.phpto enqueue Bootstrap’s CSS and JS files correctly.
Building a custom WordPress theme is one of the best ways to take full control of your site’s design and functionality. Instead of relying on pre-built themes, you can shape every detail to match your vision while keeping the code clean and lightweight.
WordPress powers over 40% of the web thanks to its flexibility, ease of use, and vast plugin ecosystem. Pairing it with Bootstrap adds a responsive front-end framework that simplifies grids, layouts, and mobile-friendly design. Together, they solve two common challenges: WordPress makes content easy to manage, while Bootstrap ensures your theme looks modern and works seamlessly across devices.
In this guide, we’ll walk through creating a WordPress theme from scratch with Bootstrap 5. You’ll set up your environment, build the essential theme files, connect everything, and style your site using Bootstrap’s responsive framework.
By the end, you’ll have a fully functional, professional-looking WordPress theme that you can customize and expand as your project grows.
What Is Bootstrap?
Bootstrap is a popular front-end framework that helps developers build responsive, mobile-first websites quickly. It was originally created at Twitter by Mark Otto and Jacob Thornton to solve the challenge of making interfaces look consistent across devices.
The framework is built on HTML, CSS, and JavaScript, and comes with a grid system, pre-designed components, and utilities that adapt layouts to different screen sizes. This makes it easier to create modern, user-friendly designs without writing everything from scratch.
Like WordPress, Bootstrap is open source and supported by a huge community. Developers can customize it, extend it, or use ready-made themes and components to speed up development while keeping full control over design.
High-end Performance Results on our Managed WordPress Hosting
Upgrade to the latest WordPress version in minutes on our managed platform.
Why Use Bootstrap with WordPress?
WordPress gives you powerful content management, while Bootstrap provides a polished front-end framework. Together, they create websites that are easy to manage, fast to build, and ready for any device. Here’s what makes the combination so effective:
Designed for modern browsing
With traffic split across phones, tablets, and desktops, responsive design isn’t optional. Bootstrap’s grid and utility classes make layouts adaptive by default, so your WordPress site automatically fits today’s browsing habits without custom CSS gymnastics.
Streamlined development
Instead of installing multiple plugins for things like sliders, menus, or buttons, Bootstrap gives you reusable components out of the box. This reduces dependency on third-party code and keeps your WordPress setup lighter.
Consistent and reliable
Anyone who’s built a site knows the pain of browser quirks. Bootstrap ships with a refined base stylesheet that irons out inconsistencies, saving hours of debugging and ensuring visitors see a uniform design everywhere.
Community-driven innovation
Bootstrap isn’t just popular—it’s battle-tested. With thousands of contributors, templates, and add-ons available, finding solutions or extending functionality is quick and accessible for developers at any level.
Cost-effective flexibility
Both WordPress and Bootstrap are open source, meaning there are no licensing fees. Whether you’re building a personal blog or scaling an enterprise site, you can customize freely without worrying about costs.
How to Build a Responsive WordPress Theme with Bootstrap 5
Now that you know what Bootstrap is and why you should use it with WordPress, let’s take a look at how to build a modern WordPress theme using Bootstrap 5.
I will walk you through the entire process, from setting up your essential files to adding dynamic content and styling.
Let’s get started…
Step 1: Get Everything Ready
Before you start coding, you need to set up your environment.
Prerequisites:
- A Local WordPress Environment: This is a copy of WordPress that runs on your computer. It’s the best way to develop themes because you can work without an internet connection and experiment without affecting a live site. A great free tool for this is LocalWP.
- A Code Editor: You need a place to write your code. Visual Studio Code (VS Code) is free, powerful, and very popular among developers.
- The Latest Bootstrap Files: Go to the official Bootstrap website and download the Compiled CSS and JS files.
- FTP/SFTP Client: To move files to your server, you’ll need an FTP/SFTP client. Cloudways provides credentials right in the dashboard, so you can easily connect with a tool like FileZilla or directly through VS Code.
For this tutorial, I’ll be using a WordPress site that I launched on Cloudways and FileZilla to access my server files.
Step 2: Create Your Theme Folder
First, let’s create the home for our new theme.
Once you have your WordPress site running, find its wp-content/themes folder. This is where all your themes live.
Here, create a new folder inside it and name it something descriptive, like my-bootstrap-theme.
Since I’m using Cloudways for this tutorial, I’ll select the server that has my WordPress application. Use my Master Credentials to log into my server using FileZilla.

After logging in, I’ll go to /applications and then select my WordPress application.

To look up my application, I’ll just look for the Database name of my app.
Check out the screenshot below to understand what I mean…

My DB Name is “mmaxtcvreg” and as you can see in the screenshot below, I can see that in FileZilla as well.

I’ll access my application folder, then as mentioned above, access the themes folder. This is the path in my case: /applications/mmaxtcvreg/public_html/wp-content/themes.
Now I’ll create a new folder inside the themes folder. I’ll call it “my-bootstrap-theme”.

Step 3: Set Up the Theme Files
Every WordPress theme needs a few essential files to work. Inside your my-bootstrap-theme folder, create the following four empty files:
- style.css
- index.php
- header.php
- footer.php
I’ll create them on my desktop.

I’ll later drag and drop them into the new folder we created using FileZilla. But first, let’s populate our empty files we just created.
Page Builders Let You Develop Websites Without Code
Find out which page builder performs the best and what features you need to create a website!
Step 4: Define Your Theme
Now, let’s tell WordPress about our new theme. Open the style.css file and add the following code to the very top (modify the code). This is a special comment block that WordPress reads to get details about your theme.
/* Theme Name: [YOUR THEME NAME, e.g., My Bootstrap Theme] Theme URI: [YOUR WEBSITE'S URL, e.g., https://yoursite.com/] Description: [A SHORT DESCRIPTION OF YOUR THEME, e.g., A custom WordPress theme built with Bootstrap 5 for my blog.] Author: [YOUR NAME OR COMPANY NAME, e.g., John Doe] Author URI: [YOUR WEBSITE OR PORTFOLIO URL, e.g., https://yourportfolio.com/] Version: 1.0.0 Text Domain: [YOUR FOLDER NAME IN KEBAB-CASE, e.g., my-bootstrap-theme] */
In my case, the code will look like this:

Note: Yes I said “add the following code to the very top”. This is a best practice instruction. It’s meant to ensure that the WordPress theme header is the first thing in the file, even if you add more CSS code later (I’ll show you this in a bit). Later, as you continue developing and want to add your own custom styles that aren’t provided by Bootstrap, you will add that code below the header comment block.
Right now, your style.css only contains the theme header. To add a custom look, you need to add CSS rules below this header. If you are okay with a minimal look, just for testing, use the code I shared earlier.
If you want a modern look, the code below provides some simple, clean styling by using a neutral color palette, a different default font, and adding some subtle shadows to key elements.
I’ll replace the contents of my style.css file with this code:
/*
Theme Name: My Bootstrap Theme
Theme URI: https://wordpress-1070279-4151948.cloudwaysapps.com/
Description: A custom WordPress theme built with Bootstrap 5.
Author: Cloudways
Author URI: https://www.claudwoys.com/
Version: 1.0.0
Text Domain: my-bootstrap-theme
*/
/* --- Custom Styles --- */
body {
background-color: #f0f2f5;
color: #495057;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
.navbar-brand {
font-weight: 700;
}
.btn-primary {
background-color: #0d6efd;
border-color: #0d6efd;
transition: background-color 0.3s ease;
}
.btn-primary:hover {
background-color: #0b5ed7;
border-color: #0a58ca;
}
.card {
border: none;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.bg-primary {
background-color: #0d6efd !important;
}
Step 5: Connect the Header and Footer
We need to create the basic structure of our website. The index.php file will be the main template that calls in the header and footer sections.
Open your index.php file and add this simple code:
<?php get_header(); ?>
<header class="bg-primary text-white text-center py-5">
<div class="container">
<h1 class="display-4 fw-bold">Welcome to Our Modern Blog!</h1>
<p class="lead">Building a custom WordPress theme with Bootstrap 5.</p>
</div>
</header>
<div class="container my-5">
<div class="row g-4">
<div class="col-lg-8">
<h2 class="mb-4">Latest Posts</h2>
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
?>
<div class="card mb-4">
<?php if ( has_post_thumbnail() ) : ?>
<img src="<?php the_post_thumbnail_url('full'); ?>" class="card-img-top" alt="...">
<?php endif; ?>
<div class="card-body">
<h3 class="card-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p class="card-text"><?php the_excerpt(); ?></p>
<a href="<?php the_permalink(); ?>" class="btn btn-primary">Read More →</a>
<p class="card-text mt-3"><small class="text-muted">Posted on <?php the_time( 'F j, Y' ); ?> by <?php the_author_posts_link(); ?></small></p>
</div>
</div>
<?php
endwhile;
else :
echo '<p>No posts found.</p>';
endif;
?>
</div>
<div class="col-lg-4">
<div class="card mb-4">
<div class="card-header">
Categories
</div>
<div class="card-body">
<ul class="list-unstyled mb-0">
<?php wp_list_categories( 'orderby=name&title_li=' ); ?>
</ul>
</div>
</div>
<div class="card">
<div class="card-header">
About
</div>
<div class="card-body">
<p>This is a basic sidebar. You can add widgets here to display authors, recent comments, or more categories. </p>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
This code tells WordPress to look for and include the header.php and footer.php files. Everything in between is the main content of your homepage.
Next, open header.php and add the following basic HTML structure. This will include the opening <html> and <body> tags and the <head> section.
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark sticky-top">
<div class="container">
<a class="navbar-brand" href="<?php echo esc_url( home_url('/') ); ?>"><?php bloginfo('name'); ?></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
Tip: The wp_head() function is crucial. WordPress uses it to add scripts, styles, and other essential information. You should always include it right before the closing </head> tag.
Now, open footer.php and add the closing tags and the wp_footer() function.
<footer class="bg-dark text-white text-center py-4 mt-5">
<div class="container">
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?>. All Rights Reserved.</p>
</div>
</footer>
<?php wp_footer(); ?>
</body>
</html>
Tip: Just like wp_head(), wp_footer() is essential. It lets plugins add their code right before the closing </body> tag.
Step 6: Enqueue Bootstrap
This is the most important step for getting Bootstrap to work correctly. Instead of using <link> and <script> tags, we’ll use a special WordPress file called functions.php. This file is the “brain” of your theme and a great place to manage scripts and styles.
Create a new file named functions.php. We’ll move this one as well along with all the other files we populated earlier to the new themes folder we created.
But first, populate the functions.php file by adding this code (modify accordingly):
<?php
// The function name should be unique and prefixed with your theme's folder name.
function my_bootstrap_theme_scripts() {
// Enqueue Bootstrap CSS from your theme's folder
wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/css/bootstrap.min.css' );
// Enqueue your main stylesheet (style.css)
wp_enqueue_style( 'main-style', get_stylesheet_uri(), array('bootstrap-css') );
// Enqueue Bootstrap JS and place it in the footer
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.bundle.min.js', array(), '5.3.7', true );
}
// Hook your unique function into the 'wp_enqueue_scripts' action.
add_action( 'wp_enqueue_scripts', 'my_bootstrap_theme_scripts' );
// Load the theme's text domain for translations (a best practice for all themes)
load_theme_textdomain( 'my-bootstrap-theme', get_template_directory() . '/languages' );
After adding the code, go back to the Bootstrap files you downloaded in the start of this tutorial. Copy the css folder and the js folder and paste them directly into your my-bootstrap-theme folder. We’ll use FileZilla for this.

Now that we’re done with that, we can move all the files we created earlier to the my-bootstrap-theme folder.

Managed WordPress Hosting Starting from $11/month.
Cloudways guarantees improvement in Core Web Vitals scores by providing a fully-managed, optimized tech stack that handles many of the key performance factors for you.
Step 7: Activate and Test Your Theme
You’re all set! Now, go to your WordPress dashboard.
- Navigate to Appearance > Themes.
- You should see your new theme, “My Bootstrap Theme,” with a blank thumbnail.
- Click the Activate button.

- Visit the front end of your website. You should see a basic page with the “Hello, World!” message styled with Bootstrap’s fonts and container classes.
That’s it! You’ve successfully created a modern, Bootstrap-powered WordPress theme. From here, you can continue to build out more pages and add dynamic content using PHP functions.

Wrapping Up!
Congratulations! You’ve successfully built a modern, responsive WordPress theme from scratch using the powerful combination of WordPress and Bootstrap 5.
In just seven steps, you’ve fully grasped the core concepts of WordPress theme development with Bootstrap:
- A clean, organized file structure.
- The essential theme files (style.css, functions.php, header.php, index.php, footer.php).
- The modern, correct way to enqueue assets using functions.php to ensure your site is fast and reliable.
- Dynamic content using built-in WordPress functions.
- A professional-looking layout powered by Bootstrap’s responsive components.
This is just the beginning. With this solid foundation, you can continue to expand and customize your theme to create a site that perfectly fits your needs.
As your project grows, you’ll need a hosting solution that can keep up. For a secure, high-performance environment, consider a managed WordPress hosting platform like Cloudways. Our optimized stack and robust features are designed to handle your site’s scaling needs without the hassle.
If you have any questions or want to show off your new theme, feel free to leave a comment below!
Frequently Asked Questions
1. Can you use Bootstrap in WordPress?
Yes, you can use Bootstrap in WordPress by integrating its CSS and JavaScript files into your theme. This lets you build responsive layouts and use pre-designed components like buttons, navbars, and modals directly inside your WordPress theme.
2. Is Bootstrap still popular in 2025?
Yes, Bootstrap remains one of the most widely used front-end frameworks in 2025. It’s supported by a large community, frequently updated, and trusted by developers for creating mobile-friendly, consistent designs quickly.
3. Is WordPress built on Bootstrap?
No, WordPress is not built on Bootstrap. WordPress is a PHP-based content management system, while Bootstrap is a front-end framework built with HTML, CSS, and JavaScript. However, many WordPress themes use Bootstrap to handle responsive design and UI elements.
4. Is Bootstrap needed anymore?
Bootstrap is still useful in 2025, especially for developers who want a fast, reliable way to create responsive websites without writing every style from scratch. While alternatives like Tailwind CSS and custom solutions exist, Bootstrap remains relevant because of its simplicity, extensive components, and broad adoption.
Abdul Rehman
Abdul is a tech-savvy, coffee-fueled, and creatively driven marketer who loves keeping up with the latest software updates and tech gadgets. He's also a skilled technical writer who can explain complex concepts simply for a broad audience. Abdul enjoys sharing his knowledge of the Cloud industry through user manuals, documentation, and blog posts.