Template Hierarchy In WordPress
WordPress uses the query string to decide which template or set of templates should be used to display the page first according to the user's request. This mechanism is called template hierarchy in WordPress. The query string is a piece of information that is contained in the link to each part of your website.
Put simply, WordPress searches down through the template hierarchy until it finds a matching template file. To determine which template file to use, WordPress:
- Matches every query string to decide which page is being requested (for example, a search page, a category page, etc);
- Selects the template in the order determined by the template hierarchy;
- Looks for template files with specific names in the current theme’s directory.
By default, WordPress sets the site’s home page for the display of our latest blog posts. If
home.php does not exist, WordPress will call
front-page.phpexists, it will override the
Read the details about template hierarchy in WordPress from this link.