- Как подключить bootstrap к wordpress – Просто!
- Почему я советую данный способ подключения bootstrap ?
- Как подключить bootstrap через function.php
- How Bootstrap and WordPress Work Together
- What is Bootstrap for WordPress?
- Why Use Bootstrap in WordPress?
- Top 5 Free Bootstrap WordPress Themes
- 1. Futurio
- 2. Shapely
- 3. NewsMag
- 4. Illdy
- 5. Sparkling
- How to Add Bootstrap to WordPress
- Step 1: Take the Necessary Precautions
- Step 2: Open the WordPress Theme Editor
- Step 3: Paste in the Reference Code
- Step 4: Finish Up
- Make the Impossible Possible with Bootstrap and WordPress
- Related Posts.
- Subscribe.
Как подключить bootstrap к wordpress – Просто!
в файле header.php (заголовок) перед функцией head() добавляем подключение либо сетки (2 сточка кода, обычно это достаточно в 90% случаях) , либо js скриптов, либо все подряд, от зависимости, что вам нужно, через сервисы:
Второй способ – тяжелее, для локальных файлов
Для подключения bootstrap к wordpress локальными файлами:
- Cкачать архив библиотеки. (Download Bootstrap)
- Распаковать содержимое архива (css, fonts,js) в свою тему в “/wp-content/themes/НАЗВАНИЕ_ПАПКИ_ТЕМЫ/bootstrap/
подключить bootstrap в header.php перед (чтобы можно было перебивать стили стандартным файлом style.css)
Попробуйте вывести html код во вкладке текст :
у вас получиться 3 колонки по ширине 33%
! я обычно использую только сетку, и подключаю только файл стилей. Можно подключить файл js в футере
Почему я советую данный способ подключения bootstrap ?
- Во первых, здесь все просто, и это рабочий вариант.
- Мне пришлось его использовать в десятках различных сайтах на wordpress.
- Также, если вы захотите тему установить на новый сайт, то она не будет конфликтовать.
- Если библиотеку подключить выше то, все стили очень легко меняются в стандартном файле style.css – таким образом, не затрагивая саму библиотеку, что легко способствует ее обновлению.
Как подключить bootstrap через function.php
/** * add js ans css bootstrap */ function wpt_register_js() < wp_register_script('jquery.bootstrap.min', get_template_directory_uri() . '/js/bootstrap.min.js', 'jquery'); wp_enqueue_script('jquery.bootstrap.min'); >add_action( 'init', 'wpt_register_js' ); function wpt_register_css() < wp_register_style( 'bootstrap.min', get_template_directory_uri() . '/css/bootstrap.min.css' ); wp_enqueue_style( 'bootstrap.min' ); >add_action( 'wp_enqueue_scripts', 'wpt_register_css' );
How Bootstrap and WordPress Work Together
Most people are probably familiar with the saying, “pull yourself up by your bootstraps.” Though it’s commonly used to mean “rely on yourself for success,” the phrase was originally coined as a reference to something impossible—after all, you can’t lift yourself using your own boots.
But unlike the goal of the popular saying, there’s nothing impossible about using the Bootstrap framework with WordPress Hosting services. Designed to make responsive web design hassle-free, Bootstrap is one of the most popular creative web tools available today.
In this short guide, we’ll explain the ins and outs of WordPress Bootstrap—what it is, why it’s so highly regarded, and how to use it.
What is Bootstrap for WordPress?
Originally designed by a team of developers at Twitter, Bootstrap is an open-source framework that allows you to create responsive, professional-looking websites with ease. In particular, there’s an emphasis on building mobile-friendly sites.
In this context, the term “framework” refers to a pre-written portion of code (in this case HTML, CSS, and JavaScript) that you can use as a jumping-off point for designing your website. The plug-and-play philosophy of Bootstrap CSS makes it ideal for users who are just beginning to work with WordPress development, but it’s equally useful to seasoned developers. Because the framework is free and open-source, you can add or edit lines of code, tailoring it to your individual needs.
In short, Bootstrap takes care of some of the tricky, behind-the-scenes programming details that help a website run smoothly, allowing you to focus on the front-end parts of your website that are visible to visitors.
Why Use Bootstrap in WordPress?
Bootstrap is a versatile tool that facilitates the creation of custom, responsive sites. But don’t just take our word for it—even multinational corporations like Nintendo and Spotify have used Bootstrap to develop stunning websites. Here are some of the many reasons to integrate Bootstrap components into your WordPress website:
- It’s geared toward mobile device usage – Perhaps most importantly, the Bootstrap template makes it easy to build “mobile-first” websites. Mobile users make up an increasing portion of web traffic—85% of all Americans own a smartphone, and 15% of U.S. adults access the internet exclusively via their mobile devices. If your site isn’t mobile-friendly, you’re missing out on a growing demographic of customers.
- It’s open-source – When a piece of technology is open-source, it means that anyone can view and modify the source code. Because the code is visible to everyone, there’s a sense of transparency. What’s more, open-source software is often more secure, as the community of developers can quickly patch any issues.
- It helps improve website speed – Bootstrap promotes the development of lean, quick-to-load websites. Instead of relying on WordPress plugins for additional functionality, you can use the framework to build helpful features directly into your custom WordPress theme. With fewer plugins, your site will run faster.
- It saves you time and effort – With dozens of pre-built WordPress customizer capabilities like buttons, navigation bars, accordions, tooltips, and more, Bootstrap makes creating beautiful, interactive websites a breeze for a web developer. All of the code required for these elements is already written, so you can spend less time programming and more time designing a memorable WordPress site.
- It’s easy to find help – As one of the most popular tools for building responsive websites (over 20% of websites use Bootstrap, including businesses like Netflix and Target), you’ll rarely come across a problem that someone else hasn’t already solved. With endless forums, instructional videos, and support documents, anyone can learn to master Bootstrap.
- It takes care of browser compatibility – Using a collection of CSS changes called Reboot, Bootstrap helps your website render consistently across various browsers and devices, creating a responsive website that will promote the overall customer experience.
- It’s free – Like WordPress, Bootstrap is 100% free to download and use.
Top 5 Free Bootstrap WordPress Themes
The easiest way to start using Bootstrap in WordPress is to activate a responsive WordPress theme that already uses it. Many theme developers include the framework within their themes, so you can take advantage of Bootstrap without having to download it and set it up.
If you want to start experimenting with Bootstrap right away, there are dozens of free WordPress themes to choose from. In no particular order, these are some of our favorites:
1. Futurio
With a wide range of potential applications—including creative portfolios, eCommerce sites, and blogs—Futurio is a terrific choice for web development pros and novices alike. It’s a remarkably fast-loading theme, thanks in part to its use of Bootstrap to add functionality.
With that said, the theme is still compatible with most WordPress plugins. Best of all, you can choose from any of their one-click demo sites and install a fully functioning website within minutes.
Add in SEO optimization and multi-language support, and it’s easy to see why Futurio makes the top five.
2. Shapely
Shapely is a one-page WordPress theme, which means all of a website’s content exists on a single landing page. While this may seem undesirable, one-page sites actually provide an optimal mobile experience, as users can seamlessly scroll through different sections.
Whether you’re looking to add testimonials, product information, calls to action, or more, Shapely makes it easy. The theme is fully responsive, SEO friendly, and supports the majority of free and paid WordPress plugins.
3. NewsMag
For the sophisticated blog, magazine, or online newspaper, there’s NewsMag. This theme harnesses the power of Bootstrap to deliver a sleek, adaptive, SEO-ready website.
Choose from four different blog page styles, or dig in and customize the homepage to your liking. Standout features include:
- Custom backgrounds
- Contact forms
- Google fonts
- Featured post banners
- Responsive video
- Dynamic widgets
- Sliders
For all your online media needs, look no further than NewsMag.
4. Illdy
There’s a trendy feel to Illdy that makes it adaptable to any business or product. And the perks of this theme don’t end with the visual appeal.
For a free theme, Illdy is incredibly versatile—potential uses range from personal blogs to established businesses. And thanks to Bootstrap, a site built with Illdy runs smoothly on smartphones, tablets, and desktop computers.
The most interesting aspect of Illdy is the ability to develop your website in “Live Preview” mode. This feature allows you to view changes on your site as you make them.
5. Sparkling
Sparkling is a masterclass in minimalism. With a slick interface that suits any application or industry, this free WordPress theme is one of the best.
Along with an SEO-friendly design, Sparkling comes packaged with sliders, popular post widgets, social icon integration, and the ability to add author biographies. With more than 20 languages available and support for infinite scrolling, Sparkling is a clear example of Bootstrap done right.
How to Add Bootstrap to WordPress
While it wasn’t designed specifically for WordPress, Bootstrap can be added to any WordPress site through various methods. However, the process does involve diving beneath the surface of WordPress, so a little programming knowledge will go a long way. With that in mind, we’ve outlined the steps for the easiest method as clearly as possible so that anyone can start using Bootstrap 5—the most up-to-date version of the framework.
Step 1: Take the Necessary Precautions
Anytime you plan to make changes to your WordPress theme—no matter how small—it’s essential to do two things first:
1. Make a backup of your site – Should something in the process go wrong, you can always start again from a recent backup.
2. Create a child theme and make all changes there – Editing your parent theme in WordPress is inadvisable, as you run the risk of overwriting the code in your main theme.
If you don’t start with these two safeguards, you risk losing any changes you’ve made or, even worse, causing your entire website to stop working.
Step 2: Open the WordPress Theme Editor
First, log in to your WordPress dashboard. From there, you’ll select Appearance from the right-hand menu, then click Theme Editor. Navigate to the Theme Header section (header.php).
Step 3: Paste in the Reference Code
Now that you have the theme header open, you’ll need to paste in a line of code just below the tag, taking care not to delete or overwrite any existing code. At the time of writing, the code used to reference Bootstrap is:
Bootstrap uses the CDN jsDelivr to deliver a cached version of Bootstrap’s compiled CSS via this code. Be sure to check the Bootstrap website and copy the most up-to-date stylesheet.
Step 4: Finish Up
All that’s left to do is click the blue Update File button, clear your browser cache, and re-open WordPress. You now have a reference to Bootstrap built into your theme, and you can start using it to optimize your website.
Make the Impossible Possible with Bootstrap and WordPress
If you’re already using WordPress as a content management system, you’ll love Bootstrap for many of the same reasons: it’s free, open-source, and a powerful tool for web development.
Once you have a Bootstrap-enabled WordPress theme, the perfect complement is a lightning-fast managed WordPress hosting plan from WP Engine. With these web solutions at the ready, you can achieve something previously thought of as impossible—building a world-class website without breaking the bank.
Join the 1.5M websites that trust WP Engine as their WordPress host.
Related Posts.
Subscribe.
Get weekly WordPress tips, tricks and news delivered to your inbox.