If you’re new to WordPress and have never done it before, don’t be apprehensive — creating a custom page template for your site is easier than you might think. Most themes come with a default page file (page.php) that contains the default page template to be used on every page created on your WordPress site, unless a custom page type is specified. If you want a page with a different layout or format than your default page template, you’ll probably want to create your own custom template type.

Creating the template is simple. All you need to do is create a new file in your theme’s directory and name it something like custom-page.php (or, if you’re going to be creating multiple custom pages, name it something more specific, like about-page.php, or two-column-page.php). You can build the custom page completely from scratch, or you can copy and paste from your default page file and make changes — it depends on how different you want the pages to look and how much time you have to make the changes. Either way, compose your file to reflect how you’d like your custom page to look.

You’re almost done. All you have to do is add the code snippet below to the very top of the page so that WordPress knows to treat this new file as a page template. This way, it will allow you to choose it from your list of page templates within the page editing page on your dashboard. The code is as follows:

<?php
/*
* Template Name: INSERT PAGE NAME HERE
* Description: INSERT PAGE DESCRIPTION HERE

*/
// other page code
?>

Give your page a template name (this is the name that will appear in your dashboard editor where you select the template to apply to your page) and a description and you’re good to go! Using this formula, you can create as many custom page templates for your site as you like — the possibilities are endless.

 

 

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge