HomeHow To How to Create Custom Single Post Templates

How to Create Custom Single Post Templates

Hi, Do you wanna to create a own custom single post template in your WordPress themes ? The “Post Attributes” options is not showing on  your theme’s on new post by default it is need to create by your requirement, The custom single post is allow you to select different templates for your posts. So in this article we will show you how to create custom single post templates in our WordPress themes.

Why you need to create a custom template on our themes? Because sometimes you may want to different look for selected posts on your website. Generally you are publishing every new post on only Default Template (single.php) but now if you want to publish selected post on different design by your chosen template there are no options but after this tutorial you can publish every you’ll selected post on different looks.

How to Create Custom Single Post Templates on WordPress Post
How to Create Custom Single Post Templates on WordPress Post

INSTRUCTION

Step 1: First of all you have to open a any plain text editor on your computer like Notepad, Notepad++ or any else and paste the following given code inside and you can modify or change as per your needs and save it:

<?php
/*
* Template Name: Full Post Width
* Template Post Type: post, page, etc
*/
get_header(); ?>
<!– your custom html start—>
<div id=”wrapper”>
<p>
your content style here
</p>
</div>
<!– your custom html end—>
<?php get_footer(); ?>
Custom Post Full Width WordPress
Custom Post Full Width WordPress

Now you can save this file as custom-single-post.php or anything as you like on your inside themes folder. for example if you are using this method on your Localhost so then save the file on this location htdocs/YourProject/wp-content/themes/ThemsName/and paste here…..

Or if you are using direct on Website so then:

  • Login to your cPnale with your username and password  (Note if you don’t have cPanel access so then you can ask your hosting provider or developer)
  • Go to File Manager
  • Now choose your domain Name or click on WWW folder
  • Now direct go to your current installed themes folder for example: wp-content/themes/ThemsName/and upload file here…..

This code is defines a new template called “Full Post Width” and makes it available for post, page, etc.

This means if you want to show this Custom template only on Single Post type so remove all type from Template Post Type: and add only Post and remove other page, etc

For more example you can see above Template Post Type illustration.

Now finally go to your Add New Post on Dashboard and check on right sidebar you will see your “Full Post Width” under the Post Attributes.

In the end

I hope you have found this article helpful. Let us me your opinion or questions if any through the comment form in below or use this form to ask your question.

You May Also Like

About the Author: Kedar Adhikari

I am WordPress Themes developer and designer and also any type of website design with minimum cost. for more information you can contact me on email gojinepal@gmail.com

Leave a Reply

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

Copyright © 2020 My WP Helper. All rights reserved.