
For example, both themes contain the same template category.php, then child theme’s template is used. When you are using a child theme, any file you add to your child theme will over-ride the same file in the parent theme. If WordPress cannot find any matching template file, the theme’s index.php file will be used. If WordPress cannot find a template file with a matching name, it will skip to the next file in the hierarchy. In block themes, HTML files are used instead, but the template hierarchy is the same. Tip: In these examples, the PHP file extension is used. With the exception of the basic index.php template file, you can choose whether you want to implement a particular template file or not. Looks for template files with specific names in the current theme’s directory and uses the first matching template file as specified by the hierarchy.

Selects the template in the order determined by the template hierarchy.Matches every query string to a query type to decide which page is being requested (for example, a search page, a category page, etc).

Put simply, WordPress searches down through the template hierarchy until it finds a matching template file. To determine which template file to use, WordPress: The query string is information that is contained in the link to each part of your website.

WordPress uses the query string to decide which template or set of templates should be used to display the page. Tip: You can also use Conditional Tags to control which templates are loaded on a specific page.
