How to create custom single post templates in WordPress

| Last Updated: | In: WordPress, WordPress Beginners


I have shared a very useful tutorial previous which explain how you can create a Custom meta box in WordPress for specific post type. In today tutorial i will explain the how to create a custom single post templates for specific posts types in WordPress.

If you are WordPress beginners, then keep close attention in this post. So lets start creating a custom post template. If you want to create a template for specific post categories, then first create a copy of your single.php & archive.php file. In this way it will inherits the theme’s html structures and color combinations.

how to create custom-post-type-wordpress

After that add post type name to the file name like. If your cusptom post type is “state”, then create file like archive-state.php and single-state.php.

How to create Single Post Template for Another Posts

In this steps you can create custom single post templates and you can select which template will be display on this post. For using this features you need to download a WordPress Plugin called Single Post Template. After installation of this plugin in your WordPress website follow the below steps.

Now open your current theme folder and create a file named custom-single-post.php or you can also copy your single.php file. Now copy paste below code in custom-single-post.php file.

single-post-template

For the create custom post template you can also install Template for Custom Post Types and Custom Post Template By Templatic

How to Create a Custom Single Post Template for Specific Author

Copy below code and paste it in your functions.php file. Then copy your author.php file and create a new file for specific author like single-post-author.php.

How to Create a custom Single Post Templates for Specific Category

Add below code in your fucntions.php file to use a separate single post template for each categories. Copy category.php and create a new file like category-single-post-type.php.

Conclusion

Above are the simple & easy steps to create a custom single post templates in WordPress. Still you need any help, feel free to add your comments in below comment sections. Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby.


You may also like:


, , , , , , ,