Actually i have deployed a wordpress running website on my local environment. I want to have some general instruction that how can i know which file points to which url. Like if i entered the url mysite.com/household-insrtuments. it opens a page in the backend i searched from the text through the project i found that this opens the file name 'housing-facilities.php' so is there any way i can view this ?
Wordpress has a template hierarchy, he search down the files in your theme until he finds a suitable template for the content hes outputing following the hierarchy.
Here it's a example from de Codex:
If your blog is at
http://example.com/blog/ and a visitor clicks on a link to a category page such as
http://example.com/blog/category/your-cat/, WordPress looks for a template file in the current theme’s directory that matches the category’s ID to generate the correct page. More specifically, WordPress follows this procedure:
- Looks for a template file in the current theme’s directory that
matches the category’s slug. If the category slug is “unicorns,” then WordPress looks for a template file named category-unicorns.php.
- If category-unicorns.php is missing and the category’s ID is 4, WordPress looks for a template file named category-4.php.
- If category-4.php is missing, WordPress will look for a generic category template file, category.php.
- If category.php does not exist, WordPress will look for a generic archive template, archive.php.
- If archive.php is also missing, WordPress will fall back to the main theme template file, index.php.
Here's a image that shows the complete hirarchy:
He will follow this behaviour unless you rewrite it with the Rewrite API.
In your case
house-facilities.php is a Custom Template, and
household-instruments is a page that uses this custom template, go to your Admin -> Pages -> Household Facilities and edit it, on the edit page you will see in the right corner a block called
Page Attributes, inside that block has a select called
Template and you will see that
House Facilities Index is selected.
So what happens? As described in the link above, if you want to create a template for multiple pages to use, you can create a file and register it as an template. To register a file as a template simply put a comment in the top of the file with the line,
Template Name: My Template, now in the edit page, you can select that file to output any page as you want.
When I'm developing a theme I like to use the Show Current Template plugin to see which files the page is loading.
Too learn about the template hierarchy see the Theme handbook.