Bootstrap and WordPress Theme Integration in 8 Easy Steps


With the rise in e-commerce and online trading facilities, customers are now more drawn towards rummaging good deals and products from the websites rather than the shops themselves. It calls for the need of smarter, self-reliant and responsive web pages which must be compatible with different modes and devices. It is the main reason why the HTML to WordPress service is getting much popular nowadays.

WordPress and Bootstrap are two robust open-source platforms which provide the facility of creating and customising your themes for websites and webpages, mainly according to your needs.

WHAT IS WORDPRESS?

WordPress is an open-source software which is extensively used for building interactive websites and blogs from a set of tools, plugins and templates. Even a person with less or no knowledge of coding can create a web page through WordPress because of its ease and simplicity. Users with pre-established websites can contact different organisations to help them provideHTML to WordPress service to make their sites more user-friendly.

WHAT IS BOOTSTRAP?

Bootstrap is a thorough and extensive User Interface library which provides almost all the essential developer tools to create and set-up the framework of any mobile app or website. Its popularity is a testimony to its excellent in-depth documentation, and its ability to deal with grids, utilities, media queries, etc.

8 EASY STEPS FOR BOOTSTRAP AND WORDPRESS THEME INTEGRATION

One can easily convert a website to WordPress theme by integrating WordPress and Bootstrap so that the design, as well as the content of their former website, remains intact.

Before starting this tutorial, let’s lay an eye on the pre-requisites for the same:

●     basic knowledge of WordPress – working, creating themes, etc

●     basic understanding of the HTML language

With everything in place, let’s begin!

1.  CREATION OF THE BOOTSTHEME FOLDER

Install WordPress and download Bootstrap. After selecting the “Theme” folder within “wp-content”, create a new folder named “BootSTheme”. Unzip the contents of Bootstrap into this new folder.

Now within the same folder, create four new files (all empty) and name them as:

●     footer.php

●     header.php

●     index.php

●     style.css

2.  PROVIDING DETAILS FOR THE THEME

To provide the basic details about your theme, copy the following code into the style.css file (enter the details according to your theme):

/*

Theme Name:

Theme URI:

Description:

Version:

Author:

Author URI:

*/

3.  COPYING THE CODE

Open bootstrap.min.css file and copy its code into the style.css file, just below where the theme details code ends.

4.  SETTING UP THE HEADER AND FOOTER

If you don’t know how toconvert a website to WordPress theme, first of all, download a free, basic HTML template to ease the documentation part. (Remember, you would still need to know HTML to perform this tutorial.)

Now, copy the header part and paste it in the header.php file, and the footer part in the footer.php file. (Don’t forget to make changes according to your website!)

Now, open the index.php file and enter the following code:

<?php get_header(); ?>

<?php get_footer(); ?>

If you upload this bootstrap WordPress integrated theme and run it, you will see the essential contents on the page, and nothing else, not even the styling.

5.  IMPORTING STYLESHEETS, JAVASCRIPT AND CUSTOMISATION

Next step is to import the stylesheets and JavaScript files.

●     Add the following code in the beginning of the header.php file to merge style.css with the website:

<link rel=”stylesheet” type=”text/css” href=”<?php echo get_stylesheet_directory_uri(). ‘/style.css’ ?>”>

●     To add the JavaScript features, open the footer.php file and enter the following code just before the closing body tag:

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

●     Customisation

Now, we will add <?php wp_head(); ?> and <?php wp_footer(); ?> in the header.php and footer.php files, respectively. This step will help in pointing specific places to the WordPress to add the plugins at.

Also, to add titles which are dynamic in nature, we will add wp_title(‘ | ‘,true,’right’); function in the header.php file.

6.  DYNAMIC POST CALLING

To have a website with features like dynamic post calling, paste the following code in index.php file:

<?php

query_posts(‘posts_per_page=1’);

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

<div>

<h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>

<p><?php the_excerpt(); ?></p>

</div>

<?php endwhile; wp_reset_query(); ?>

7.  DEFINING CATEGORIES AND LISTS

Enter the following code in the index.php file to define and list the categories:

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

<div>

<div>

<ul>

<?php wp_list_categorues(‘orderby=name&title_li=’); ?>

</ul>

</div>

</div>

</div>

8.  DISPLAYING LATEST POSTS WITH AUTHORS

To display the name of the author with the post, we will use the_author() function :

<div>

<?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(); ?>

</div>

WordPress and Bootstrap together can prove to be one of the most dynamic integrations ever in the field of website theme creation and customisation. These two open-source platforms are easily accessible and free of cost. If you are unaware of the coding or computer languages and technology, you must contact specific organisations which can help you with HTML to WordPress service.