How to Create Custom Post Templates in WordPress

Share This Article:

Ever thought of creating custom post templates in WordPress? Apart from Page templates we can also create “Post Templates” which can be used for specific posts to give a different look. This feature is not available is WordPress as default option and can be added by using a simple plugin.

Custom Post Template is a free WordPress plugin that provides a drop-down menu of all available post templates in post edit screen. Select a template for that particular post and single.php file will be replaced by that template. Pretty simple way do it, but before that you need to create some “Post Templates” by following this method.

Create Custom Post Templates in WordPress

Create Custom Post Templates in WordPress

Be careful while creating custom post templates. If anything goes wrong, you will end up breaking theme files. So its recommended to Backup your WordPress theme before trying hands on this tutorial.

Step 1: Download and Install “Custom Post Templates” plugin. For details guide check How to install a WordPress Plugin.

Step 2: Create a single Post Template by including this syntax in it.

<?php
/*
Template Name Posts: Simple
*/
?>

While creating a page template we have to define its name in “Template Name:” field. Similarly, for Post Template we need to assign a name by using “Template Name Posts:” field.

In the above example I have named that post template as “Simple” and you can use any other name based on the requirement. Also, this is the name which will be displayed in Drop-Down menu too.

Easily Create Custom Post Templates in WordPress

Step 3: After creating the Custom Post template, copy it to your theme directory where index.php file is located. Please do not use any sub folders or sub directories.

Tip: If you want to create Custom Post Template instantly, then create a copy of single.php file and rename it. Make all required changes to that renamed file and upload it back to theme folder.

How to use Custom Post Templates in WordPress?

After uploading “Post Templates” to theme folder they will be available to use on individual posts. From the drop-down menu select the “Post Template” you wish to use and hit on publish button.

Select Custom Post Template WordPress

Voila, a custom post template will be used for article overriding contents in single.php file. Incase if no post templates are available then a message “This theme has no available custom post templates.” will be displayed instead of drop-down menu.

Need some help in setting up a custom template for specific posts? Drop a comment here and we will get back to you.

Genesis is the most flexible WordPress theme framework that comes with tons of options. We have been using Genesis on all of our blogs and recommending the same to you. Every bit of it is coded according to the standards. Give it a try!

Comments

  1. It is always better to define a category-template instead of creating a new custom post. As this type of data is totally hidden whenever you change the theme. Thus create a lots of problem. Am i right bharat?

  2. Anugeeth says:

    Thanks relay helpful to me in a critical condition…..

Speak Your MindComments Policy →

*

Looking for More Awesomeness?