When to Use Bootstrap for Your WordPress Theme (And When Not To)

When to Use Bootstrap for Your WordPress Theme (And When Not To)

Do a Google search for 'WordPress Theme with Bootstrap' and you'll get hundreds of results. These include guides telling you how to use Bootstrap to build your theme as well as commercially and freely available themes using the Bootstrap framework.

Search for 'Bootstrap' in the WordPress theme repository and you get 199 results. That's a lot of choice.

It seems that developing WordPress themes using Bootstrap is all the rage. But is it always the best approach for your theme development workflow?

Here I'll look at the pros and cons of using Bootstrap for WordPress theming, and help you to identify when using Bootstrap will help your workflow and when it won't.

What Is Bootstrap?

The Bootstrap website describes Bootstrap as:

the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.

This tells you a couple of things:

  • Bootstrap is responsive and mobile first.
  • It uses HTML, CSS and JavaScript.

If you're paying attention, you'll notice that that doesn't include PHP. While Bootstrap is an application framework, it isn't like a theme framework: it doesn't give you any of the theme template files you'll need to create if you're going to leverage it in a theme. Instead, what it does give you is a framework of styles and scripts that will make it easier for you to get a responsive site up and running and add interactions and events that require JavaScript.

Bootstrap was originally designed as a framework to help Twitter developers work more efficiently and consistently. Its early name was Twitter Blueprint, which was changed to Bootstrap after more developers became involved and the project started to grow.

It was released as an open source framework in 2011 and has since been used to power a variety of applications, including WordPress themes.

When I first came across Bootstrap, its main selling point was its responsiveness at a time when a lot of web development (including WordPress development) still had to catch up with responsive web design. It wasn't originally responsive: this was added in 2012 and the framework was made mobile-first in 2013.

If you download Bootstrap, you'll see that it consists of a set of stylesheets (including minified versions), JavaScript files and glyphicons, which are included in font files. These don't replace your theme files: instead you call them in your stylesheet and functions file as needed.

I'm not going to provide an in-depth explanation of how you use Bootstrap with your WordPress theme here: that's covered in detail in this tutorial. Instead I'll look at how Bootstrap might help or hinder your WordPress theme development workflow and the situations in which you might or might not use it.

Benefits of Theming With Bootstrap

The very popularity of Bootstrap as a framework for WordPress themes indicates that it definitely has a place. So let's take a look at some of the benefits of using Bootstrap.

It's Responsive and Mobile-First

Bootstrap automatically gives you responsive, mobile-first styling for your theme. If you've been struggling to get to grips with responsive theme development, it will save you the hard work of learning how to make your own stylesheets responsive and add media queries.

Bootstrap uses a grid-based layout of 12 columns with grid classes which you can use with the elements in your template files to make your content fit into the grid.

Benefits of this approach include:

  • If you aren't familiar with media queries, you don't have to write them yourself.
  • The grid-based system uses object-oriented CSS, giving you lots of flexibility for styling the elements in your theme and on your pages.
  • The mobile-first approach means your CSS is cleaner and more efficient than a desktop-first stylesheet.

It Uses Modern, Clean and Attractive Design

In my opinion, the layout and typography you get with Bootstrap is very nice. It won't win any design awards, but it will help you build a theme that's modern, easy to interact with, and legible. There are some styling features I particularly like:

  • the use of the <small> element for secondary text within headings
  • the styling for blockquotes and citations
  • table styling, which is much nicer than what I've seen in a lot of WordPress themes

It Plays Nicely With HTML5

As well as introducing its own classes for styling, Bootstrap also includes styling for the full range of HTML5 elements that you can expect to use in your theme. Styling all these from scratch can be a real hassle, so it saves you a lot of work, as well as making it easier for you to use semantic markup in your theme.

It Gives You Easy Access to Scripts

Instead of having to use plugins or source scripts from elsewhere, Bootstrap provides you with a nice range of scripts which will help you add the most commonly used animations and interactions to your site. These include:

  • transitions
  • modals
  • dropdowns
  • tooltips
  • popovers
  • buttons

... and more. This can speed up your development, and also ensures that all your scripts play nicely with each other. If you're going to be using more than one or two of these, Bootstrap can make your theme development much easier; however, if you're only going to be using one or maybe two, there might be a more efficient approach with less added code.

Downsides of Theming With Bootstrap

However, I don't believe that Bootstrap is the right tool for all WordPress theme developers. Here are some of the downsides to using Bootstrap when developing your themes.

There's a Lot to Learn

I've already referred to the responsive grid system used in Bootstrap's stylesheets, and the multitude of classes you can use to leverage this in your theme. This is great if you're prepared to familiarize yourself with those classes and work out how to use them in your theme. However, if you don't need such a complicated layout and will only be using a few of the styles, you might find that you spend a disproportionately large amount of time working through all the classes and working out which ones to use.

The stylesheet includes 155 lines of code just for that grid layout in the smallest screen width: that's a lot to get to grips with if you want to get the most from it, and more than most themes will need.

In addition to this, there are classes for the glyphicons, for buttons, and much more.

If your theme will make use of a significant proportion of this styling (or you're going to use Bootstrap to support multiple themes), then it's worth taking the time to learn how Bootstrap styles work. But if you only need a couple of columns and a responsive design, then it might be overkill.

It Uses Fixed Media Queries

The media queries used by Bootstrap are based on an assumption about screen and device widths that is becoming outdated.

These are the media queries:

For the last year or so, responsive development has been moving away from predefined breakpoints for media queries and towards design-based breakpoints. While these media queries are based on and will certainly work with Bootstrap's design (so shouldn't cause any problems on any of the supported devices or browsers, of which there are many), it doesn't give the flexibility you have if you're coding your own.

If you were to decide to add an intermediate media query to your stylesheet, then you'd have to take the 155 lines of layout styling for the grid system and adapt that to your new breakpoint—not a task I'd envy!

It Adds Bloat

Yes, I guess you were waiting for this one—the stock response of any skeptical web developer to a new framework or tool.

Bootstrap undeniably gives you a lot of functionality and styling you can use in your theme, and that's a great thing. However, if you're only going to use a fraction of what's provided, it means you're adding all that extra code for nothing.

The files are minified, which does help, but even so, do you really need all that unused code in your theme?

It Can Discourage Imaginative Design

Add Bootstrap to your theme, call the stylesheet from your theme's stylesheet and bam! You have a ready-made, responsive layout that looks just fine. Most of us would be tempted to leave it at that, adding some color tweaks perhaps but not much more.

This means that your design will be based on what Bootstrap provides, and not on what's required for your site. I work with a lot of clients, and before we even start to discuss the design of their site I ask them questions about their site's objectives, audience and more. All this will inform the design of the site, both in terms of visuals and in terms of the user interface.

The danger of lots of themes using Bootstrap is that we'll end up with so many themes that look essentially the same. WordPress theme developers have been doing a great job of throwing off the accusations of their themes 'looking like WordPress' in recent years, so do we want all our themes to 'look like Bootstrap'?

Bootstrap and WordPress Are Very Different

Ultimately I think the most significant factor that might put you off using Bootstrap is the fact that it was never designed to work with WordPress, and that it works in a very different way.

A WordPress theme framework will often give you everything you get from Bootstrap, and in a way which is much more closely aligned to the way WordPress developers work. These don't have to be expensive or have huge codebases: the Wonderflux theme, for example, is free and open source, and includes a responsive grid system (like Bootstrap but less bloated) and a library of functions and hooks that you don't get with Bootstrap.

An example of how Bootstrap and WordPress aren't compatible is in the design of navigation menus. Your WordPress menu won't work out of the box with Bootstrap enabled: instead you'll have to create a custom nav walker. This isn't difficult to do if you're comfortable with the code, but does add another step to your theme development. 

Summary

Bootstrap definitely has its benefits. If you need an attractive, clean and responsive layout for your site and access to a range of JavaScript effects, then it can help speed up your theme development process.

However, if you're going to get the most from Bootstrap, you'll need to spend some time learning it. There's a lot to learn with Bootstrap, and if you're not going to be making use of everything, then it might not be worth it.

To conclude, I would recommend using Bootstrap in a range of circumstances:

  • if you're prepared to put some effort into learning how to use Bootstrap
  • if you're going to be using a lot of Bootstrap's features, such as the grid system and the scripts
  • if you don't have a designer working with you (or aren't one yourself) and want a ready-made design
  • if you want to develop a responsive theme but don't know how to write media queries

And I'd advise not using it in these circumstances:

  • if you want more flexibility with regard to breakpoints, design or layout
  • if you'll only be using one script, or you won't be using the grid system
  • if you want a quick fix—Bootstrap isn't one of those
  • if there's a WordPress theme framework or starter theme that does the job you need and gives you more, such as functions and hooks

Ultimately the decision is yours!

Source: Tuts Plus

About the Author

Comments

  1. … [Trackback]

    […] Read More Infos here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  2. … [Trackback]

    […] Find More Informations here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  3. … [Trackback]

    […] There you will find 39539 more Infos: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  4. … [Trackback]

    […] There you will find 96210 more Infos: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  5. … [Trackback]

    […] Read More Infos here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  6. … [Trackback]

    […] Informations on that Topic: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  7. … [Trackback]

    […] Read More here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  8. … [Trackback]

    […] Informations on that Topic: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  9. … [Trackback]

    […] Read More: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  10. … [Trackback]

    […] Read More here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  11. … [Trackback]

    […] Informations on that Topic: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  12. … [Trackback]

    […] Informations on that Topic: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  13. porno says:

    … [Trackback]

    […] Read More: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  14. … [Trackback]

    […] Find More Informations here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  15. likri.com says:

    … [Trackback]

    […] Read More Infos here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  16. … [Trackback]

    […] Read More here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  17. … [Trackback]

    […] Read More: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]

  18. … [Trackback]

    […] Read More Infos here: designncode.in/when-to-use-bootstrap-for-your-wordpress-theme-and-when-not-to/ […]