SHARE

How to add new php file in wordpress theme

For personalized wordpress themes custom .php files are very important. By default you can’t create new php file in wordpress theme from wordpress dashboard. You can use two way to create file on wordpress theme.

  1. Create new php file on desktop and upload it on wordpress theme folder.
  2. Or second way is create new php file directly on theme folder from cPanel .
Create New Php WordPress
Create New Php WordPress

Method 1.

To Creating new php file with first method you can use any html editor or notepad on pc. Open notepad in computer.Create a new blank file in notepad. Now click on file and select save as. Choose file name. select file type to all files and save it.

Example: you want to test.php file on wordpress theme folder. Open blank file in notepad. In the file name field write test.php .select file type to all file and click to save.

test.php file is created. Now you can upload test.php file to theme folder on your web server by using any ftp manager like Filezilla.

Method 2.

In the second method login to cPanel. cPanel is the control panel provided by your web host to you. Go to file manager.

Click on new file to create file
Click on new file to create file

 

Locate you wordpress installation folder. Under the wordpress installation folder go to wp-content/themes/your-theme-name. And open it by double click.

 

Now you are in your theme folder. On the upper left side of screen , click on new file tab to create new file. In the file name section write test.php and click to create button.

Edit new php file from wordpress dashboard
Edit new php file from wordpress dashboard

 

You can edit test.php file from wordpress dashboard. To locate test.php go to Appearance and then Editor. On right side bar locate test.php and click on it to edit.