Creating a WordPress Theme with Bootstrap: When to Use? How to connect bootstrap to wordpress? Creating a template for wordpress bootstrap.

From the author: hi all. In the last article, we looked at connecting a framework to a web page, but if we are talking about how to connect Bootstrap to WordPress, then everything looks a little different here. Let's look at how to make the connection correctly.

So, let's create a task for ourselves. We have a wordpress template, we need to connect bootstrap to it. How to do it? It would seem that there is nothing complicated, the same code that we used to connect to the web page will do. But that was not the case, if you try to add the same code in header.php, in which the head section is displayed in the wordpress template:

< link href = "css/bootstrap.min.css" rel = "stylesheet" >

Nothing will work, the styles of the framework will not connect. Why and what should we do about it? First, look at the path leading to the style sheet. Let's remember that wordpress reads the path starting from the root folder of the site, and not the template, while our path is written only relative to the template. The actual path where the file is located looks like this:

/wp-content/themes/theme-name/css/bootstrap.min.css

/ wp - content / themes / theme-name/ css / bootstrap . min. css

So, the styles are not connected because the path is simply incorrectly set. Secondly, wordpress has special functions that allow you to include scripts and styles in the right way. I suggest you just use this function and connect the framework files in the best way. To do this, we will need to write some code in functions.php in our active template.

To edit it, connect to the site via ftp and go to the directory with the active theme, find the appropriate file there. I suggest you keep it backup just in case. Now open it with your preferred editor. You don't have to study its contents too much, anyway, if you are not familiar with wordpress functions, you will not understand anything, except from the developer's comments.

Go to the very end, here we will add the code that will connect the framework to the engine.

Since we are not learning about wordpress functions here, I will just give you a ready-made code that will immediately connect the js and css files of the framework. Below I will allow myself to explain this code a bit.

function load_bootstrap()( wp_enqueue_script("bootstrap-js", get_template_directory_uri()."/js/bootstrap.js"); wp_enqueue_style("bootstrap-css", get_template_directory_uri()."/css/bootstrap.css"); ) add_action("wp_enqueue_scripts", "load_bootstrap");

function load_bootstrap()(

wp_enqueue_script ("bootstrap-js" , get_template_directory_uri () . "/js/bootstrap.js" ) ;

wp_enqueue_style ("bootstrap-css" , get_template_directory_uri () . "/css/bootstrap.css" ) ;

add_action("wp_enqueue_scripts" , "load_bootstrap" ) ;

So we will need to write new feature, let's call it arbitrarily, I suggest this - load_bootstrap, so that it is immediately clear. Inside the function, we write two wordpress functions. The first is responsible for connecting scripts, the second - for css-styles. The functions themselves work absolutely identically and have 2 required parameters:

The name of the function. It can be written arbitrarily. Again, I propose to name it in such a way that everything is immediately clear.

The path to the included file. It is very important to set it correctly, if you just write js/bootstrap.js, then nothing will work, since I already said that wordpress looks for files from the root of the site, but there is simply no js folder at the root, it is present in our template, where you should drop the framework files in advance.

Actually, in order to correctly set the path, you need to get the path to the folder with the active template, and then add the path to the script in this template. How to do it? The get_template_directory_uri() function will help us here. We register it and dock the path to the file.

If you need to connect more files, then we just write the wp_enqueue_script or style function again from a new line, specify the name and path in the parameters.

This completes the compilation of the function that will connect our framework files. But if now you want to start using the capabilities of the framework, then it's too early. We need to give the engine this function to execute. This is exactly what the last line of the above code does, which begins with the add_action function.

In it, we must specify 2 parameters: the first will be unchanged in our case, this is the wp_enqueue_scripts function. It is with s at the end that is important! The second parameter is to specify the name of our common function, in which we include our js and css file.

So, we have considered correct connection bootstrap to wordpress. If in the future you need to include new framework files, you will not need to write a new function for this, but just add or change the necessary lines of code in the load_bootstrap() function you already have.

Due to the fact that we have done everything this way, the framework connection will work when the domain name changes, when the template name changes, etc. Well, you can start using the framework for your own purposes, that's where I end this article. If you want to master bootstrap as soon as possible, I recommend that you go through, in which you can make up 2 sites, a landing page, that is, a one-page site, and also get good theoretical training.

Bootstrap 4 framework. Fast start

Learn the basics of Bootstrap 4 with a practical example of how to build a blog from scratch

Hi all. For a long time already we wanted to make a blank template for developing sites for wordpress. We love the bootstrap frame very much - if someone knows something simpler and easier for developing adaptive sites - then write in the comments ( best advice we will place it in the article and indicate the link to your site).

We note right away that this bootstrap wordpress theme is based on another clean template - https://github.com/saxap/clean-wp-template , however, we made some changes and additional code cleaning.

bootstrap wordpress theme for development

Yes, the theme is primarily for developers. If you like clean code and fast loading speed, and at the same time you can write a small booth theme, then this template is for you.


Data from PageSpeed ​​Insights

Just install bare wordpress, throw on a theme and get the following:

  1. Extras have been cleaned through function.php wordpress functions, which litter the code and increase the site loading time (emoji removed, the REST API, its filters, events and embeds disabled).
  2. Created 2 menus adapted for bootstrap. Through the admin panel create the top and bottom menus.
  3. A style.css file is included, where you can specify your own CSS code to customize the template (In this file, I added a little code to decorate the theme, however, you can remove this code to keep the original bootstrap look).
  4. Post thumbnails and custom image sizes.

We would recommend that you move the block

to the footer.php file and through styles and position: absolute visually raise it back to the site header. This is necessary for SEO-optimization of the code. With this action, you can significantly raise the H1 heading up, which will certainly have a positive effect on the search results of your site. Here we start from an idea that we heard a long time ago, however, we stick to it:

There is nothing better for a search engine than a printable page.

However, moving the header is up to you. But in favor of my position, I will give an authoritative example - https://devaka.ru/.

After redesigning the site in the code, you can see that the header is loaded from the footer (the site is also made on wordpress). And we would trust Sergei Koksharov.

Files in the Bootstrap WordPress Theme

With files, everything is standard - just nothing more.

  • 404.php- template 404
  • author.php- author post template
  • archive.php- post archive
  • categories.php- category posts template
  • comments.php- comment template, there is the output itself and the form, markup of the list of comments in functions.php
  • footer.php- site footer
  • functions.php- template functions
  • header.php- site header
  • index.php- a template for displaying the latest posts for the main
  • loop.php- post in a loop
  • page.php- regular page
  • search.php- search pattern
  • sidebar.php- sidebar
  • single.php- separate post page
  • style.css- theme styles and description
  • tag.php- posts by tag
  • /js - bootstrap and template scripts
  • /css - bootstrap styles
  • /fonts - bootstrap fonts

We note a small nuance - the block

taken out of header.php, for more convenient development. For example, you need to make a slider the entire width of the page - just make a slider in a custom page template without having to close open fixed-width tags.

Download, try. Write your opinion in the comments.

WordPress themes based on the Bootstrap framework combine the best features of CMS functionality and responsive layout techniques. Availability mobile version the site has become the new norm and has a positive effect on the place in the search results. Bootstrap embodies the idea of ​​100% “responsive” design, due to which sites using Bootstrap WordPress templates display equally well on desktop and mobile devices. Using media queries in the css framework allows the layout to automatically adjust to the desired screen resolution.

25 Bootstrap WordPress Templates for Different Themes

The multi-landing template is extremely popular due to its versatility. It is a selection of WordPress theme with a ready-made design of various subjects. All preparations include:

  • adjustable headers, footers;
  • customization in a visual editor without coding;
  • adaptability is entered under mobile devices;
  • integration with the popular WooCommerce plugin for an online store.

In total, more than three hundred template options are offered, from which you can always choose the one that suits the task.


2. Puca

Optimization is one of the main "chips" of this template, which the authors declare immediately. The WordPress theme has been ranked as one of the best in 2018 and promises to gain even more popularity in 2019. The convenient settings of the “smart menu” thanks to the Elementor plugin will help you realize any idea without having to learn web programming. Ready for customization 350 pages.


3. One Love

An elegant "clean" theme for a wedding Internet shop, which can be easily adapted to other tasks. The authors suggest:

  • 22 unique pages;
  • ample opportunities for portfolio placement - sliders, scrolling settings;
  • plug-ins for online shopping are included;
  • developed internal pages.

A set of Google fonts, icons is also offered. Everything is perfectly adapted for mobile.


4. Dentalia

Resource dental clinic universal in design concept, so it will be enough to change pictures using the intuitive plugin of the Elementor constructor to get a business card, landing page, a small site of any subject. Included are extensive customization options for sliders, plugins and other options. A useful Before and After plugin will help you evaluate the effects of edits and develop your own unique design based on the finished one.

Related Topic: 20 Dentist Website Templates »


5. KnowherePro

  • extended version of WooCommerce - Sumo;
  • built-in calendar functions, event manager;
  • cookie processing plugin;
  • the ability to add cards;

All settings are online, completely visual, remain intuitive, even if you connect the "advanced" options.


6. Cocoon

A simple and very effective theme in the style of "flat design" is suitable for landing dedicated to any product or online stores. The kit offers an advanced Ajax plugin for advanced search by model, characteristics. You can post "three-dimensional" images of goods, give promotions for certain special offers. Mobile navigation is just as powerful due to its adaptability and responsiveness.


7. iMate

For just $40, you get a modern, 2019-themed template with a catchy design that is fully compatible with Bootstrap. A versatile landing page tool. Integrated with major social networks, including YouTube for video embedding. Optimized for fast loading and online trading.


8. Stribe

Universal in terms of convenience and functionality, the basis for landing page and business card sites. There is everything you need:

  • visual setting;
  • endless choice of color schemes;
  • many widgets and additional details;

Also suitable for portfolios thanks to the built-in slider menu with easy scrolling. It is possible to embed video. Compatible with Bootstrap.


9. Miex

A template that combines the capabilities of Parallax effect and Bootstpap, guaranteeing maximum adaptability, responsiveness and perfect UX on any device. The convenience of the WordPress theme is that all settings are set in advance, the user edits in mode visual editor without fear of making mistakes in the code. Also adapted for search engines.


10. Kallyas

Kallyas is a creative all purpose theme that comes with an impressive set of WP options and can be used for eCommerce. Like many WordPress templates Bootstrap 3, Kallyas is made in accordance with the concept of mobile-first. Text and video tutorials, as well as a responsive technical support team will help you quickly deal with theme customization.


11. Kalium

Kalium is a creative template created for professionals whose professional activities require an information web resource on the Internet. Demo sites for all types of projects are attached to the theme, their list is constantly updated. Compatibility with Bootstrap 3.x makes the template fully responsive.


12. Jevelin

Jevelin is a responsive WordPress Bootstrap template for business websites, freelancer online resumes, personal web pages. Developed with the latest design trends in mind, the template is suitable for both simple and advanced projects. The built-in WooCommerce plugin turns a Jevelin website into trading floor.


13. Uplift

Uplift is a theme with a "rubber" mobile-first layout. Its clean semantic HTML5 code helps achieve high performance site without sacrificing its design. Due to the page loading speed, premium design features, functionality and productivity, the template can become the basis for a web project of any subject.


14. Foundry

Foundry- universal pattern with clean code and great design. Compatibility with WooCommerce allows you to use Foundry as a Bootstrap online store template. The theme complies with WP standards, has an attention to detail and works with all popular plugins.


15.H-Code

H-Code is a versatile, creative theme with responsive and retina-ready layout. The theme is optimized for page loading speed and is compatible with the W3 Total Cache plugin. The code and structure of the template comply with seo standards. H-Code will be a great choice for a business portal, online store or portfolio.


16.Entrepreneur

Entrepreneur is a template for a small company website equipped with functionality for booking and online booking. The WooCommerce plugin implements the ability to accept payments and deposits. The template includes many easily customizable forms. It also allows you to sync your schedule with Google Calendar.


17 Launchkit

Launchkit is a commercial landing Bootstrap template for selling sites. Thanks to the resulting next update With WooCommerce support, you can organize the sale of goods through a landing page. Direct calls to action and attention-grabbing order forms successfully serve the purpose of increasing conversions.


18. Lambda

Lambda is a responsive Bootstrap theme suitable for any project. You can install Bootstrap demo templates on Lambda in one click in the site build section. The popular framework makes the design of their pages adaptive, as a result of which visitors see a beautiful site from any device. Several plugins and bonus options are included in the template for free. Due to the support of WooCommerce on the template, you can raise an online store.


19. Kleo

Kleo is a template that is a convenient tool for creating online communities and social networks. The social network functionality is provided by the BuddyPress plugin integrated with the theme. Thanks to the use of Bootstrap, Kleo site templates perfectly adapt to the screens of mobile gadgets.


20.WPLMS

WPLMS is a theme equipped with the functionality of a learning control system. This is not just a template for educational portals, but a complete set of eLearning options. The system was tested on highly visited (up to 1 million users) resources and as part of the WPLMS theme can be used on the site of a training center, school, university or private tutor.


21 Real Homes

Real Homes is the leading real estate agency website template, offering a theme-appropriate web page design and options that are sought after by real estate agencies. Theme allows you to create packages paid subscription for users and accept payments via Paypal, Bank Transfer and Stripe.


22. Porto

Porto is a responsive theme with WordPress and eCommerce functionality. The types of projects that her Bootstrap demo templates are prepared for: store, landing page, web studio, professional services sites. Using Visual Composer, you can customize the design of the site without touching the code. Each element of the pages of a web resource created on Porto is ideally displayed on screens of any resolution.


24. Education

Education is a template for educational portals. During its development were involved latest versions Bootstrap and Font-Awesome frameworks have made front-end themes simpler and more efficient. Using the theme, 12 unique demo sites were developed, among which there are both simple Bootstrap templates and more advanced ones.

Hi all. For a long time already we wanted to make a blank template for developing sites for wordpress. We love the bootstrap frame very much - if someone knows something simpler and easier for developing adaptive sites - then write in the comments (we will post the best advice in the article and indicate a link to your site).

We note right away that this bootstrap wordpress theme is based on another clean template - https://github.com/saxap/clean-wp-template , however, we made some changes and additional code cleaning.

bootstrap wordpress theme for development

Yes, the theme is primarily for developers. If you like clean code and fast loading speed, and at the same time you can write a small booth theme, then this template is for you.


Data from PageSpeed ​​Insights

Just install bare wordpress, throw on a theme and get the following:

  1. Function.php was used to clean up unnecessary wordpress functions that litter the code and increase the site load time (emoji removed, the REST API, its filters, events and embeds were disabled).
  2. Created 2 menus adapted for bootstrap. Through the admin panel create the top and bottom menus.
  3. A style.css file is included, where you can specify your own CSS code to customize the template (In this file, I added a little code to decorate the theme, however, you can remove this code to keep the original bootstrap look).
  4. Post thumbnails and custom image sizes.

We would recommend that you move the block

to the footer.php file and through styles and position: absolute visually raise it back to the site header. This is necessary for SEO-optimization of the code. With this action, you can significantly raise the H1 heading up, which will certainly have a positive effect on the search results of your site. Here we start from an idea that we heard a long time ago, however, we stick to it:

There is nothing better for a search engine than a printable page.

However, moving the header is up to you. But in favor of my position, I will give an authoritative example - https://devaka.ru/.

After redesigning the site in the code, you can see that the header is loaded from the footer (the site is also made on wordpress). And we would trust Sergei Koksharov.

Files in the Bootstrap WordPress Theme

With files, everything is standard - just nothing more.

  • 404.php- template 404
  • author.php- author post template
  • archive.php- post archive
  • categories.php- category posts template
  • comments.php- comment template, there is the output itself and the form, markup of the list of comments in functions.php
  • footer.php- site footer
  • functions.php- template functions
  • header.php- site header
  • index.php- a template for displaying the latest posts for the main
  • loop.php- post in a loop
  • page.php- regular page
  • search.php- search pattern
  • sidebar.php- sidebar
  • single.php- separate post page
  • style.css- theme styles and description
  • tag.php- posts by tag
  • /js - bootstrap and template scripts
  • /css - bootstrap styles
  • /fonts - bootstrap fonts

We note a small nuance - the block

taken out of header.php, for more convenient development. For example, you need to make a slider the entire width of the page - just make a slider in a custom page template without having to close open fixed-width tags.

Download, try. Write your opinion in the comments.

From the author: Search for “Creating a WordPress Theme with Bootstrap” or “How to Make a WordPress Theme with Bootstrap” and you will get hundreds of links. Among them will be guides on how to concoct your paid or free theme using Bootstrap.

If you search the WordPress theme repository for "Bootstrap", you'll find 199 results. Quite a selection, isn't it. It seems that creating themes with Bootstrap is the most popular way to create WordPress themes today. But is this approach ideal in all cases?

Below I have put together all the pros and cons of building Bootstrap themes to help you understand when this method will greatly help you, and when it only complicates the work.

What is Bootstrap?

The Bootstrap site says this:

Bootstrap is the most popular HTML, CSS, and JS framework for creating mobile first responsive websites.

From this it follows that:

Bootstrap is responsive and uses the mobile first technique.

It uses HTML, CSS and JavaScript.

If you're careful enough, you'll notice that the list doesn't mention PHP. Bootstrap doesn't work like a theme framework: it doesn't come with the template files you'll need to create a theme. Instead, you get a set and structure of styles and scripts that help make the theme responsive, add modern interactions, animations, and events that are powered by JS.

Initially, Bootstrap was conceived as a framework for Twitter, which was supposed to make the work of developers easier and more efficient and consistent. The first name was Twitter Blueprint, over time, as more and more developers were involved in the project, and the project began to grow, it was changed to Bootstrap.

It was released open source code in 2011 and has since been used in in large numbers web applications, including WordPress themes.

Back when I first encountered Bootstrap, its main advantage was that it was completely responsive. The rest of the frameworks were catching up, even WordPress. But at the time of creation, it was not adaptive, it became one in 2012. The mobile first technique was added in 2013.

If you load the framework, you will see that it consists of a set of style files (including minified versions), JS scripts and glyph icons that are in the font file. These files do not replace your theme files. You must include them in the theme and call the necessary tools as needed.

In this article, I won't go into details on how to work with Bootstrap. Instead, I will tell you about how this framework can help or, on the contrary, make it difficult to work with WordPress, as well as in what situations it should and should not be used.

Benefits of Bootstrap in WordPress Themes

The huge popularity of this framework suggests that it has definitely occupied its niche. So let's take a look at some of the benefits of Bootstrap:

It is responsive and uses mobile first technique

With Bootstrap, by default, you get a responsive site that is fully mobile responsive. If you go out of your way to make your theme responsive and write styles and media queries for it yourself, this framework will save you a lot of time.

Bootstrap uses a 12-column grid system with its own classes, these classes can be added to your elements to achieve the grid effect. Advantages:

If you are completely unfamiliar with media queries, then you don't have to write them.

The grid system uses object-oriented CSS, giving you the flexibility to style your theme elements.

Mobile first means your CSS code will be much cleaner and more efficient than the usual approach.

Modern, clear and attractive design

In my personal opinion, Bootstrap's template and typography are very attractive. It won't win you awards in web design, but it will help you create a modern theme with a legible and clean interface. Below I have provided a list of some of the features that I myself use:

small tag for secondary text in headings

Styling quotes and quotation marks

Table styling looks much better than most WordPress themes

Excellent HTML5 compatibility

In addition to its own styling classes, Bootstrap also provides styles for the full set of HTML5 tags. Styling these elements from scratch is extremely tedious, so the framework will save you a lot of time and effort, as well as improve the semantics of your theme.

Easy access to scripts

In order not to use plugins of unknown origin, Bootstrap has a fairly extensive set of commonly used scripts built into it. Among them are scripts for creating:

Smooth transitions

Modal windows

dropdown lists

Tooltipov

Popovers

… and much more. All this will speed up the development process, as well as ensure excellent coordinated work of all scripts. If you use all the elements to the fullest (more than two from the list), then the development process will really speed up. But if you need one or just two interface elements, then there are more effective ways with less code.

Bootstrap 4 framework. Quick start

Learn the basics of Bootstrap 4 with a practical example of how to build a blog from scratch

Disadvantages of Bootstrap Themes

However, all the pros don't outweigh its cons and I don't think Bootstrap is the right choice for WordPress themes.

Large volumes of studied information

I already mentioned the grid system in Bootstrap styles, as well as the many classes that can be used for styling. If you want to explore them all, that's great. And what if you do not need so much new information. If you don't need such a complex template and only use a couple of styles, you'll find yourself spending a disproportionate amount of time reading all the documentation because of a couple of classes.

Only the styles for the grid system on small screens take up 155 lines: too much. And also classes for glyph icons, buttons, etc.

If your theme will use the number of styles in proportion to the time spent on studying the documentation, then this framework is worth using. AT otherwise, if you need to create a couple of columns and add responsiveness to the design, this is overkill.

The framework uses static media queries

Media queries in Bootstrap use screen sizes and devices that become obsolete over time. Below are examples of media queries:

/* Very small devices (phones, less than 768px) */ /* By default Bootstrap has no media queries */ /* Small devices (tablets, 768px and above) */ @media (min-width: @screen-sm-min ) ( ... ) /* Medium devices (desktop, 992px and above) */ @media (min-width: @screen-md-min) ( ... ) /* Large devices (Large desktop screens, 1200px and up) */ @media (min-width: @screen-lg-min) ( ... )

/* Very small devices (phones, smaller than 768px) */

/* There are no media queries by default in Bootstrap */

/* Small devices (tablets, 768px and above) */

@ media (min - width : @ screen - sm - min ) ( . . . )

/* Medium devices (desktop, 992px and above) */

@ media (min - width : @ screen - md - min ) ( . . . )

/* Large devices (Large desktop screens, 1200px and above) */

@ media (min - width : @ screen - lg - min ) ( . . . )

Over the past year, developers have moved away from fixed resolutions in media queries towards screen resolutions based on design. These media queries still work with the Bootstrap design (cause no issues with any supported device or browser). However, a more flexible way is to code requests manually.

If you had to add an intermediate media query, that would mean adding 155 more lines to your styles. Everything you need to get the grid system working, and you also need to adapt these styles for the new resolution - not an easy task!

He bloats the code

I think you were waiting for me to say this - the standard response of all opponents of new frameworks or tools.
Bootstrap undeniably provides a huge amount of functionality and a lot of styles that you can use in your themes, and this is its plus. But on the other hand, if you use only a couple of elements from the entire set, this means that you just added all this code in vain.

The files are minified, which undoubtedly reduces their weight. But even so, are you really sure that you need all this unused code in your themes?

disappears creativity in design

Add Bootstrap to your theme, call it styles and bam! You have a fully responsive template that looks just fine. Most of us will add a couple of new colors and that's it.

This means that your design will be completely built on the features of Bootstrap, and not on what you need. I had a lot of clients, and before I started discussing the design of the site, I asked them about the goals of the site, the main audience, etc. All of these guiding questions affect the final design in terms of visual and user interfaces.

The main danger lies in the fact that almost the same themes are obtained in Bootstrap. In recent years, WordPress theme developers have successfully fought off attacks with the slogan “by themes it’s immediately clear that this is WordPress.” And with Bootstrap, the situation is worse so far, all Bootstrap themes “look like Bootstrap”.

Bootstrap and WordPress are very different

The main factor that outweighs everything else is that Bootstrap was not designed for WordPress, and they work very differently.

Often, a WordPress theme framework can achieve almost everything that Bootstrap does, but it was made specifically for WordPress. It is inexpensive and does not have as much code: for example, the Wonderflux theme is free and open source. It has a responsive grid system (just like Bootstrap, only less code), as well as a library of features and tricks that Bootstrap does not have.

An example of the incompatibility between Bootstrap and wordPress is menu design. Connected Bootstrap menu WordPress will no longer work by default: you will have to create a custom nav walker. It's not difficult if you understand the code, but already extra work.

Generalization

Bootstrap definitely has its upsides. Especially if you want to get an attractive, clear and responsive website template with big set js effects. This approach will speed up the development process.

However, if you want to get the most out of Bootstrap, you will have to spend a lot of time learning. And there is something to learn. If you don't use everything, it might not be worth it.

If you are really willing to take the time to learn all the features of Bootstrap

If you are going to use many properties like grid system and scripts

If you are not a web designer and need a ready-made design

If you need responsive design but don't know how to write media queries

And don't use Bootstrap in the following circumstances:

If you need more flexibility in screen resolutions, overall design or layout

If you use only one script or do not use the grid system

If you need to fix something quickly

If exists WordPress theme, the functionality of which meets your requirements

Ultimately, the choice is yours!

Internet