If you like using Bootstrap and WordPress as much as I do, you should now have the perfect base WordPress theme to start any project moving forward. At this point, our WordPress theme has all the Bootstrap components and features, several custom page templates, styled comments, Font Awesome, custom functions, and much more.
In the following video, I go over how you can use this base theme for your WordPress projects and how you can quickly add a custom homepage to the theme.
- Create a new file called
template-homepage.phpin the root of your WordPress theme with the following code:
template-homepage.phpPHP123456789101112131415161718192021<?php/**** Template Name: Homepage** The template for displaying the homepage.*** @package bootstrapwp*/get_header(); ?><div class="container"><div class="row"></div></div><?php get_footer(); ?>
- Go over to getbootstrap.com and get the example Jumbotron code and add it to the
template-homepage.phpfile. It should now look like the following:template-homepage.phpPHP1234567891011121314151617181920212223242526272829<?php/**** Template Name: Homepage** The template for displaying the homepage.*** @package bootstrapwp*/get_header(); ?><div class="container"><div class="row"><div class="jumbotron"><h1>Navbar example</h1><p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p><p><a class="btn btn-lg btn-primary" href="../../components/#navbar" role="button">View navbar docs »</a></p></div></div></div><?php get_footer(); ?>
- Go into the WordPress Dashboard and create a new Page using the Homepage template
- Go to Settings -> Reading from the WordPress Dashboard
- Set the “Front Page” to the newly created Homepage from step 3
- Optional: Set the “Posts Page” to display on any page you would like
- Reload the front-end of your WordPress site and check out the new homepage!
Notes from the Video
Now that we have our base WordPress theme complete, the next step is to add a theme options panel and start creating different settings to the theme. The next series of tutorials will really start adding functionality to our premium WordPress theme.
Please let me know what you think of this tutorial and if you need help with anything.