We are often asked about how to find which files to edit in a WordPress theme.
WordPress themes consist of several different files. Sometimes it may be hard for beginners to figure out which files they should edit to make certain changes in their theme.
In this article, we’ll show an easy and quick way to figure out which files to edit in your WordPress theme.
Understanding WordPress Theme Template Files
All the top WordPress themes follow the official best practices. This means they use the standard file and template structure to organize all the code.
For instance, all WordPress themes have archive.php, single.php, functions.php, and other files.
Each of these files is used as a template to display a particular area of your WordPress website. For example, single.php is used to display single posts and page.php template is used to display a single page.
Understanding the WordPress template hierarchy gives you a better understanding of how WordPress works.
If you ever need to add code to your WordPress theme, then it also helps you figure out which files you may need to edit.
For more details, see our complete cheat sheet for the WordPress template hierarchy for beginners.
That being said, let’s take a look at how to easily find which files to edit in WordPress theme.
Finding Template Files to Edit in WordPress Theme
The plugin works out of the box, and there are no settings for you to configure.
Upon activation, you need to visit the front end your website and you will notice a new ‘What The File’ menu in WordPress admin bar.
Now you need to just take your 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 you to the default WordPress file editor where you 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 you accidentally lock yourself out of your website, then you would have to use an FTP client to fix it. That’s why we recommend using a FTP client or the File Manager app in your WordPress hosting control panel.
You can edit theme files using any plain text editor like Notepad.
Making direct changes to your WordPress theme is also a bad idea. Those changes will disappear when you update your theme.
The ‘What The File plugin’ can help you locate the theme files that you need to copy and edit in your 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. You should only use this plugin in the development environment such as a staging site.
We hope this article helped you find which files to edit in your WordPress theme.