Integrate a WordPress Blog to Your Bootstrap Website

So, you built a great website in bootstrap. Your site is live and great, works fine in all devices and browsers, everything is perfect. Now, your customer wants to add a blog to your website. WordPress has great themes for blogs but none of them are going to look like your custom website. Here is how you can integrate the WordPress blog into your website and make the blog look same as the rest of your website. You can create your own WordPress theme!

WordPress Blog

WordPress blog is great as it is perfect for content management, backend, and frontend. You can add multiple users, media, plugins, comments, and so on. Backups and versioning is great with WordPress blogs. Corporates have been building full fledged websites using WordPress Divi themes. Inorder to integrate a WordPress blog to your HTML site built using bootstrap, you can follow certain steps and achieve same functionality.

Settings in the cpanel

  1. First install WordPress in your root folder and give the folder name blog.
  2. Download bootstrap and save in the wp-content-themes folder.
  3. Save additional css such as font-awesome and other css you used in your Bootstrap website in the same folder as bootstrap css
  4. Create new index.php, home.php, header.php, footer.php, sidebar.php, functions.php, page.php, single.php, style.css. Each of the files have their significance in creating your theme in WordPress.
    • index.php: Loads your blog
    • home.php: Loads the blog posts from the database
    • header.php: Loads the header in every post when the get_header() function is called
    • footer.php: Loads the footer in every post when the get_footer() function is called
    • sidebar.php: Loads the sidebar contents when the get_sidebar() function is called
    • functions.php: Needed to load the jQuery in wordpress package to this website and also the sidebar contents
    • page.php: Loads the page you create and can act as a template for every page in your WordPress blog or Website
    • single.php: Loads the individual post which the user clicks in a page with comments function
    • style.css: Loads the styles for this blog
  5. Edit header.php and copy paste the content including the navbar from your existing website template. Edit the css href to php function bloginfo. Load the stylesheet_url using the function. Add wp_head and wp_enqueue_script to load jquery in this page. Save header.php. In the navbar list, add wp_list_pages function to get the additional blog page you created in the WordPress admin login. This way, your WordPress blog will be at the end of the menu items in your website. After the blog is setup, go ahead and edit all the pages of your website and add menu item blog to link it to the blog page.
  6. Edit footer.php and copy paste the footer section of your website template. Remove all the javascript functions at the end and add wp_footer() function. Save footer.php.
  7. Edit sidebar.php and add the function dynamic sidebar to get the sidebar content on all pages and make the sidebars widget friendly. It will load the sidebar contents if there are any existing. Save sidebar.php
  8. Edit index.php and load the get_header() function first. Next, in a loop check the posts and load the posts and the title and content using the the_title and the_content functions. If there are no posts display a message, saying there are no posts. At the ends, load the get_footer() function.Save index.php
  9. Edit page.php. Load the header and footer contents. Divide the page into two columns and load the posts in the left column and the sidebar in the right column. Save page.php
  10. Edit functions.php. Add function to register the scripts such as bootstrap.min.js and script.js in the page. Then enqueue the scripts of your page. Add another function to register the sidebar contents and the before_widget, after_widget, before_title, and after_title style of the sidebar contents. Save functions.php. You can override the default jQuery that comes with the WordPress install with a latest version in the functions.php.
  11. Edit home.php and load the header, footer and sidebar. In a if condition, check if there are any existing posts. For every post, get the post title, links, content, and date, using respective functions. If there are no posts, display a message. Save home.php. WordPress uses home.php to load the blog posts. Save home.php
  12. Edit single.php and and load the header, footer and sidebar. Get the contents of the post and get comments section. This page will be loaded if a single post is clicked. Save single.php
  13. Edit style.css and import the bootstrap, font-awesome, and other css used in your website. Edit the navbar and footer styles to load exactly the same way as the rest of your website. WordPress uses style.css to load the style for your blog. Save style.css.
  14. If you have multiplepages in your blog, you can have a front-page.php and load the header, footer, and sidebar there.

Settings in the WordPress login

Login to your website and blog using the WordPress credentials. Delete the existing page and create a new page called Blog. In the Settings, go to Readings and set the page to load the latest posts. In the appearance settings select the new them you have created. Go to Live Preview and test the site if it is loading properly. Make your current theme as the default theme for your WordPress and start writing blogs. Voila! you are almost done.

Keep checking for the WordPress updates and backups. Test it in all devices and browsers for responsiveness. Maintain your site and the WordPress blog at the same time with minimal distraction to the user. Add some ads to your blog to make some dollars!! 🙂

Three Steps to Post a Google AdSense Ad in Your Blog

Google Adsense is widely popular among the blog industry. Everybody is blogging, but the real challenge is setting up the ads in a WordPress blog. Here are three simple steps to post an ad in to your blog.


1. Login as Admin to your blog
  1. Click on Posts menu and select a page to insert Ads
  2. Select HTML view for inserting google Ad javascript code. Leave an empty line above and below the <script>… </script> tags
  3. To add the Ad beside the blog image: Add <table><tr><td>Ad script or blog image</td><td>Ad script or blog image</td></tr></table>
2. Login to AdSense to create an ad
  1. Under AdSense Setup, identify the content type and subject for which you need the ad
  2. Click AdSense for Content to select ad type
  3. Decide the place where you want to show the Ad on blog
    • Just after the heading of blog => rectangular image or text 700 X 15
    • In the middle => rectangular preferably text with multiple columns may be 4 or 5
    • Next to a image => square 300 X 200
  4. Select Ad Unit. You can experiment with Link Unit also
  5. Select Size horizontal or vertical and so on
  6. Add five subject categories related to the blog contents
  7. Give a name to the ad and generate javascript
  8. Copy the javascript from the text box


3. Go back to the blog contents and paste the javascript
  1. Save and Update and Publish the blog
  2. See the blog and make sure you have the correct ads appearing
  3. Click back to Manage Ads and edit if needed
If the ads are not to your expectation or want to change any categories you can go to AdSense and make the changes without copying and pasting the javascript again.

The AdSense is smart enough to post the ads according to the changes you make there without copying and pasting the javascript. Happy advertising and happy blogging with Adsense. 🙂