How To Create a Custom Post Template

Have you ever wanted to use a different template on a post? By default, most WordPress themes don’t normally offer a range of templates to choose from to use on different posts.

Pages however, are a different story and even the free Twenty Eleven default theme for WordPress offers 7 different ones to choose from.

Video On Creating Custom Post Templates

Using the default post template on all your blog posts is a bit boring so if you want to show you subscribers a different format for a particular reason then those templates can be copied over and used to create unique posts.

Depending on the theme you have installed, yours should also offer a range of different page templates which can be used on posts as well if you follow this little trick i have for you.

Caution: Its best practice to always create a full backup of your files & databases before making changes to your WordPress site.

Tools You Can Use

For this tutorial i’ll be using the page templates from the Canvas theme and File Manager in cPanel.

You could use any theme which offers a range of different page templates and also use FTP rather then File Manager if you wish.

I’ll also be using a child theme which you can create quickly and easily in cPanel using File Manager. This way your custom post templates will not be overwritten and lost when you update your theme.

Using a Plugin

Rather than playing around with php code, the easiest way to use your page templates on posts is to simply install the custom post template plugin.

Once you’ve installed the plugin by Simon Wheatley, you’ll find a module under your post tags in your Edit Post screen. Post TemplatesIts now time to create a post template by copying one of your existing page templates to your child themes folder.

Copy Page Templates

Using FTP or better still, File Manager in cPanel, copy the page templates you want to use for posts over to your child themes folder.

Navigate to wp-content/themes and inside you themes directory you’ll find your page templates.

Copy Page Template

Using File Manager, right click the ones you want to use as posts and copy them to your child themes directory

Child Theme Post Templates

Note: Page templates use different names than post templates so you’ll also need to edit the name at the top of each new post template file.

Edit File Names

Page templates use Template Name  whereas post templates use Template Name Posts so you’ll need to change this info at the top of each new post template.

To change this template name simple click Code Edit in File Manager and change Template Name to Template Name Posts

Template Name Change to Template Name Posts

You’ll now see your new custom templates in the drop down.

Custom Post Templates

Click the drop down to choose a new post template.

You can see from this screen shot that i’ve added 3 new templates.

Custom Single Post Templates

Note: You need to copy your themes index.php file into your child themes directory as well otherwise the post templates will not work. Be careful not to move the files but copy them to your child theme.

5 Reasons Mad Mimi Works Better

mad-mimi
  1. Sends From Your Email Address - More personal & higher open rate
  2. Cheapest - $42 for list of 10,000 emails, unlimited sends
  3. Ease of Use - The easiest system to create & setup campaigns
  4. RSS to E-Mail - Auto send list of latest posts
  5. Auto Send Any Number of Days - enables you to offer multiple newsletters at different frequencies.

Click here to create a free account.

Comments

  1. mfan says

    Thanks for your great tutorial. I tried this out on twenty fourteen theme with fourteen extended plugin. I customized a full width post template, but the feature content post I used to try out this custom post template only shows without sidebar. The content does not extend to 100% full width. How can I make the post extended to full width? Do I need to modify the stylesheet?

    Here is the template:

    QUOTE

    <?php

    get_footer();

    UNQUOTE

    FYI, even though I have fourteen extended plugin, which can set all featured content posts to full-width once for all, I still keep all the featured content posts in content-sidebar format setting. Only I used one post to try out the custom post template.

    And I didn't use child theme. I placed the post template in the twenty fourteen theme folder.

    Your advice would be appreciated.

    mfan

    • Brad Dalton says

      Please use your real name and an email address linked to your Gravatar and i will help you otherwise i will not help anyone who is anonymous. Thanks for your understanding.

    • Brad Dalton says

      Hi Marco

      Good question however You would need to be more specific. I always test these things out locally using different themes which is something you might want to try.

      I’m not very experienced with GetShopped and prefer to use WooCommerce or Easy Digital Downloads.

Ask a Question