While I was reading template hierarchy.
The single post template file is used to render a single post. WordPress uses the following path:
single-{post-type}-{slug}.php – (Since 4.4) First, WordPress looks for a template for the specific post. For example, if post type is product and the post slug is dmc-12, WordPress would look for single-product-dmc-12.php.
single-{post-type}.php – If the post type is product, WordPress would look for single-product.php.
I am slightly confused the above two in bold face do they differ technically somehow or It is Just the matter of convention while creating Templates for Posts.
single-{post-type}-{slug}.php
does not exist then WordPress will loadsingle-{post-type}.php
. If you want the product page for a single product to look different than the other product pages, then you would createsingle-{post-type}-{slug}.php
so that only that one product page is affecteddmc-12
, then WordPress will first look for a file calledsingle-product-dmc-12.php
in the theme directory. If it finds it it will use that template when creating the page. If this file does not exist, then it will look for a file calledsingle-product.php
in the theme directory. If that file does not exist, then WordPress will look for a file calledsingle.php
in the theme directory.