How to create a custom WordPress template

Below we show how to create a custom WordPress template, this will give you more control over pages you develop, good for landing pages where you might want to do more unique things without the worry about how it will affect other pages.

1. Find the directory where your theme lives.
Usually something like “/wp-content/themes/theme” Where theme is the name of your theme.

2. Create your custom template in the directory from Step 1.
Give it a name like “landing_page.php” and insert the following code seen in Step 3.

3. Insert the following code into the landing page template.

Template Name: Landing Page
<?php get_header(); ?>
This is my landing page!
<?php get_footer();

4. That’s it, you have just created a WordPress template.
The Template Name: Landing Page tells WordPress that this will be a custom page template, where Landing Page is the name that will show up in the drop down selector when you create your page.

What’s a template good for?

A template will lay the basic architecture for a page, you may wish to have a different template for things like news, events, galleries, landing pages, etc. Any page you have that you would like to look much different from the rest of your site may be the time for creating a template.

Typical differences in templates you may find

  • Full width, one column
  • Two columns with right sidebar
  • Two columns with left sidebar
  • Three columns

Facts about WordPress Templates

  • Page templates are used to change the look and feel of a page.
  • A page template can be applied to a page, a section of the page or a group of pages.
  • Page templates require a name as seen in step 3, before they can be used by an editor.

Leave a Reply

Your email address will not be published. Required fields are marked *