How to Find Which Files to Edit in WordPress Theme
How to locate the files in a WordPress theme that need editing is a question we get a lot.
WordPress themes are made up of numerous files. Beginners may occasionally find it challenging to determine which files they should modify to make specific modifications to their theme.
In this article, we’ll outline a simple and efficient method for determining which WordPress theme files to change.
Acquiring Knowledge of WordPress Theme Template Files
The official best practices are adhered to by all popular WordPress themes. This indicates that they organize all of the code using the common file and template structure.
For instance, all WordPress themes feature files such as functions.php, single.php, and archive.php.
Each of these files serves as a display template for a certain section of your WordPress website. For instance, the single.php and page.php templates are used to display single pages and articles, respectively.
You can better grasp how WordPress functions by being aware of the hierarchy of its templates.
It also aids in helping you identify which files you would need to modify if you ever need to add code to your WordPress theme.
With that said, let’s look at how to quickly identify the WordPress theme files that need editing.
Locating Template Files for a WordPress Theme to Edit
The What The File plugin needs to be installed and activated first. See our step-by-step tutorial on installing a WordPress plugin for more information.
There are no settings that need to be changed for the plugin to function.
You must go to the front end of your website after activation to see the new ‘What The File’ option in the WordPress admin bar.
Now all you have to do is move your mouse over the menu item, and a drop-down menu containing the template files used to display this page will appear.
When you click on a file name, the normal WordPress file editor will open, allowing you to edit that specific file.
However, because there is no undo feature in the WordPress file editor, we do not advise using it to change theme files.
You would need to use an FTP client to unlock your website if you unintentionally locked yourself out of it. We advise utilizing an FTP client or the File Manager application in your WordPress hosting control panel because of this.
Any plain text editor, such as Notepad, can be used to edit theme files.
Another terrible idea is making direct changes to your WordPress theme. When you upgrade your theme, such modifications will be lost.
You can add some CSS to WordPress as custom CSS if that’s all you’re doing. You must make a child theme for any additional modifications to your theme files.
You can use the “What The File plugin” to find the theme files you need to copy and modify for your child theme.
All users that are signed in will be able to see the menu item that the plugin put to the admin bar, which links to an outside website. This plugin should only be used in a testing context, such a staging website.
We hope this information was helpful in identifying the WordPress theme files you need modify.
Comments are closed.