Template for custom post type

Sometimes you create any custom post type like product testimonial etc. but then you face problem with templating for custom post type. You did not call archive or single page directly for that. In that case you can create 2 template file for custom post.

  • archive-{post_type}.php
  • single-{post_type}.php

Eg. You have created custom post type “product” then archive.php will be archive-product.php and single.php will be single-product.php.