With millions of sites running on the WordPress platform, improving the visibility of your site requires modifying the look and feel of the website. So, irrespective of how beautiful your WordPress site may be, you’re bound to customize your site theme sooner or later. And, for making any changes to your theme requires editing the PHP files.

The best part of building a site on WordPress is the ability it provides for editing the files online within the browser using the WordPress built-in editor – the Theme Editor. In short, you can edit all your website files from your site’s admin panel, and then save the edited files on the local system. Finally, you just need to upload those files on your server using an FTP client.

The purpose of writing this post is to explain the process that a WordPress site owner need to follow for editing PHP files from the admin menu. But before starting with writing the files, there are a few considerations you must take into account for getting the changes done successfully.

Things to Consider Before Editing PHP Files

1. Create a Backup of Your Website

This is the first thing you should consider while making any edits to your site core files. Doing so will help recover the lost data or restore your entire site – when it breaks down because of any changes made to the core files of your website. Thus, it is advised that you should create a backup of your site as well, to overcome any damage caused to the site.

2. Make Use of Text Editor For “Editing” Purpose

As a WordPress user, you’ll most likely have an idea of how WYSIWYG editors produce messy code, making it difficult for you or your hired developers to customize the theme. However, using text editors can help you edit plain text within your files without performing any formatting. Another great benefit of text editors is that they come loaded with several features like code auto-completion, syntax highlighting, and many others – that makes the task of modifying the theme by writing code easier.

Note: Whenever you decide on using a text editor, refrain from utilizing a Word Processing Program as it embeds nonessential code or unwanted changes that can cause a file to break.

3. Learn About Correct File Permissions

Often when making any tweaks to a WordPress website theme, most of us overlook setting up file permissions appropriately. That could result in making the site prone to hacker attacks. Each WordPress file comes with a set of permissions that renders users with the ability to read, write, edit or delete a file. Let’s suppose, the file you want to make edits to isn’t writable. In that case, you won’t be able to perform any edits within that file unless you change the file permissions.

But amending the permissions of any ‘.php.’ File incorrectly can make your site vulnerable to attacks launched by malicious users. So, it is imperative for you to know how to set correct file permissions. Once you know about such process, you’ll be left with making the desired changes to the file permissions. For this, you’ll have to take advantage of an FTP client (such as FileZilla). Next, after accessing the FTP client, open the cPanel and click on Files → File Manager icon. Next, press the “Go” button from the “Directory Selection” pop-up wherein you only need to make changes to the numeric value as provided in the dialog box below:

ftp file attributes

Getting Started With Editing WordPresss Theme and PHP Files

You can make any edits to WordPress PHP files, by making use of either Theme Editor or Plugin Editor. These are two built-in editors that can be found in every WordPress install. In our case, we need to make use of the Theme Editor since we need to modify our theme.

The Theme editor is just like a text editor and can be accessed from the site’s admin dashboard screen by clicking on the Appearance → Editor. Below you can see the “WordPress Theme Editing screen” of the Twenty Fourteen theme:

theme editor

As you can see in the image above, several PHP files of your active WordPress theme are displayed on the editor screen on the right side. You just need to open the file that you would like to edit for customizing your theme. Now when you choose to edit a file, here are a few considerations you should keep in your mind:

  • In the ‘Theme editing screen’ you will find a button labeled as “Update File”. This button is necessary for making changes to your WordPress website files, but it might not be available in all the servers in case your file is not writable. However, you can make the ‘Update File’ button visible on your theme, by simply making changes to the file permission.
  • Secondly, remember that clicking on the drop down menu of the theme editor screen with “active” and “inactive” theme options won’t activate other theme for your site. Unfortunately, some site owners believe in such a notion. But, in reality hitting the drop down menu will only open the files that you want to edit. But, for activating the theme you’ll need to click on the activate option by moving to Appearance → Themes from the dashboard menu.
  • Lastly, for implementation of the required changes in your WordPress theme, you need to edit the functions.php file. However, for making the changes to the functions file you must know how to code. But be careful about pasting the code in the right manner or else you might end up getting locked out of the site. So, you must study online tutorials or refer to other resources to avoid making any errors in the functions.php file.

Wrapping Up

Are you a novice and trying to learn the process of modifying WordPress files and theme? Then reading this post will help you learn the process of modifying a WordPress website theme easily. People usually write code for customizing a theme. And some, who do not know how to code, usually find code online for making alterations to the theme – that can break your website. So, it is advised that you must always use a child theme for making any changes to the theme. And once you are satisfied with those changes, you can implement them in your main WordPress theme.

Author info
Jack Calder is a consistent PSD to WordPress theme developer in Markupcloud Ltd where he has learned and developed various WordPress websites. Jack is energetic, cool and a fun-loving guy also. In his free time he likes to learn & explore new things on the web.