WordPress 4.7 introduced a new feature to create templates for post types. Before, we were only able to create templates for pages.
This new feature is not much different than creating a template for a single post in form of single-post-type.php file. Although, creating templates with this new features allows admin users to choose templates for the post, which ultimately gives more flexibility to your clients.
Let’s see how we can create a template for normal Post Type.
First of all, in your theme folder, create a template file. Let’s assume we have created a file full-width-post.php. Now, just like page templates we have to mention for which post types this templates can be used. We can do this comment section.
Template Name: Full-width-post layout
Template Post Type: post, page
Notice the second line in a comment, Template Post Type. This mentions for which post types we can use this template. Here, we are using the template for post and pages.
In the post editing area, once we create this template for the post, we will be able to see a section called Post Attributes, which will list our template in Template drop-down.
As I said before, how it works is not much different than before. So no need to explain that part. the only difference is the ability to choose a template from the post itself from the admin area.