In this last times a lot of readers asked how do you find which files to edit in their WordPress theme? If you are new to WordPress theme development and want to customize your theme, you need to learn which template files in your theme you need to edit. In this article, we will show you how to easily find which files to edit in WordPress theme.
Wich template Files in WordPress Themes to edit?
WordPress themes control how our website looks to our users. Each theme contains several template files which control the appearance of a particular section or page in our WordPress theme.
single.php file controls the appearance of single posts on our website. It is not the only file to do that.
If our theme does not have a single.php file, then WordPress will look for alternate templates like index.php to display the page.
Most beginners are not familiar with template hierarchy in WordPress. This makes it harder for them to figure out which files to edit when they want to customize their themes.
Having said that, let’s see how to easily find out which files to edit in our WordPress theme.
Finding Template Files in WordPress Themes
First thing we need to do is install and activate the What The File plugin.
The plugin works out of the box, and there are no settings for you to configure.
Upon activation, we need to visit our website and we will notice a new ‘What the file’ menu in WordPress admin bar.
Now we need to just take our mouse over to the menu item, and it will display a drop down menu listing the template files used to display this page.
Clicking on the file name will take us to the default WordPress file editor where we can edit that particular file.
However, we do not recommend using WordPress file editor to edit theme files because there is no undo option. If we accidentally lock ourself out of our website, then we would have to use a FTP client. That’s why we always using a FTP client and plain text editor to edit our files.
Making direct changes to our WordPress theme is also a bad idea. Those changes will disappear when we update our theme.
If we are just adding some CSS, then we can add it as custom CSS in WordPress. For all other changes we should create a child theme.
‘What The File plugin’ can help us locate the theme files that we need to copy and edit in our child theme.
Note: The menu item added by the plugin in the admin bar will be visible to all logged in users, and it has a link to an external site. We should only use this plugin in development environment.
We hope this article helped you learn how to find which files to edit in WordPress themes. As there is a lot of sources of how to test our edited files in WordPress themes.
- Click to share on Google+ (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to share on Facebook (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pocket (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to email this to a friend (Opens in new window)
- Click to print (Opens in new window)