How to create template for post in wordpress

I know how to create a custom template for a specific wordpress page. However, I would like to create a template for a specific custom post type. Is that possible and if it is possible, how can I do that?

Related posts

Leave a Reply

2 comments

  1. To add a custom template for custom post types you can use single-{posttype}.php template. You can look at the template hierarchy diagram for more details.

    For example if your post type is called books, your filename for the template should be single-books.php

  2. If you have created a custom post type

    If you have created a custom post type then you need to create a template who’s name will be smiler to the custom post type for example if you have created a custom post type “product” then you will create a template with name product.php in your theme directory and to display a particulate post of your custom post type you will create another template with name single-product.phpthis template will be used to display your custom post and remember whatever custom post you create same name will be used to name your custom post type template and do not forget to add single in the beginning.

    Template for a particulate post or a post of particulate category

    And to display particular post in different template and to use different template to display post of particular category you can follow this link.