If you make changes to the themes you use or build your own themes, you should do so with care, especially if you are using a newer wordpress version that has syntax highlighting built into it.
Failure to use caution when updating your site via theme modifications can cause all kinds of headaches such as losing every change you have previously made to your theme due to a simple typo that the syntax highlighter cannot handle.
With that in mind, here is a good way to go about making changes to themes without worrying about losing previous work, having your site messed up, etc.
Create a local copy of your theme.
- Create a directory on your computer to store a backup copy of your theme in.
• Windows Instructions- Open Windows Explorer
- Right-click your start menu
- Select "Explore"
- Create a Backup Directory For Your Web Site
- On the left side, select "My Documents"
- From the file menu select "File" → "New" → "Folder"
- You should see a new folder on the right named "New Folder". Type in the name you want for your folder and then press enter on your keyboard. I tend to use my domain name for server backups. For example privateerwebsolutions_com for this site.
- Open Windows Explorer
- Download the contents of your website to your backup folder
• FTP Instructions- Connect to your web server via ftp
• FileZilla Instructions:- Open Filezilla
- From the filemenu select "File" → "Site Manager"
- Select your website on the left
- Select Connect
- Download your web site to your backup folder
• FileZilla Instructions:- On the top left panel browse to your newly created folder
- Select your newly created folder so that the bottom right panel shows its contents (a single folder with .. as the name)
- On the top right panel, browse to your web sites root directory ( /public_html )
- Select your public_html directory in the top right panel to show its contents in the bottom right panel.
- Copy all of the files and folders in the bottom right panel to the bottom left panel (except the folder with the name ..).
• The quick way:- Select the item after the .. folder
- Scroll down to the bottom of the file list
- While holding down shift on your keyboard, select the last item listed
- Select any of the highlighted items and drag them to the bottom left window with your mouse.
- Connect to your web server via ftp
When finished, you will have local copies of all of the files on your website contained within your backup folder. Additionally, they will be stored in the same directory structure as they exist on your server.
Backup old versions and make changes to themes locally
When you want to make changes to one of your themes, you should first make backups of any files you want to edit. I recommend making your backups by adding the year, month, day, and time to the filename so that the backups look like file-2009-06-21-0510pm.php.
- Create a backup of the file to be edited
• Windows Instructions:- Open windows explorer
- Right-click your start menu
- Select "Explore"
- Locate the file you want to make changes to
- On the left side, browse to the directory that contains the file you want to edit.
For example, if you want to edit index.php in the atahualpa theme on privateerwebsolutions.com, you would browse to "My Documents\privateerwebsolutions_com\wp-content\themes\atahualpa"
- On the left side, browse to the directory that contains the file you want to edit.
- Create a copy of the file you want to edit
- Select the file you want to edit
- From the file menu select "Edit" → "Copy" to copy the file.
- Select the directory you want to place your copy in.
For this example you would select the atahualpa folder on the left. - From the file menu, select "Edit" → "Paste"
This will create a copy with "Copy of " placed before the original name.
- Rename the copy you created
You want to remove "Copy of" and add the date to it- Select "File" → "Rename" from the file menu
- Delete the "Copy of " from the front of the file name
- Add the year-month-day-time to the filename as YYYY-MM-DD-HHMM
For example, Copy of index.php would become index-2009-06-30-1201pm.php
- Open windows explorer
- Edit your file
You should be editing the file with the original name, not the copy you created with the date after it as that is the original file as it existed during the date and time you gave it.
By creating backup files like this, you know what the file looked like during the dates given in the filename. Additionally, sorting them by filename keeps your backups with the original in order of date edited.
Upload your edited files
Once you have completed making changes to a file, you will need to upload it to your webserver to test it out.
- Upload your edited file
• FileZilla Instructions- Open FileZilla
- Connect to your web server
- Copy your edited file to your server
- In the top left panel browse to the directory which contains your edited file
- Make sure you can see your edited file in the bottom left panel
- On the top right panel browse to the directory that contains that file on your server
- Make sure you can see the file you want to replace on the bottom right panel
- Drag your edited file from the bottom left to the bottom right
- Confirm that you want to overwrite the original when prompted
- Repeat step 3 for each edited file
- Check your changes
Visit your website and verify that things look as you expect them to.
Should something go terribly wrong
If you put a file up and things go so badly that you cannot quickly fix them, you can overwrite your changes with your most recent backup of any files.
- Change the name of your edited file
- Rename your most recent backup to its original name
- Upload your most recent backup to overwrite your changed version.
- Verify that things look proper again.
That should get your site working again while preserving any changes you made so that you can attempt to fix them.
Alternate methods
Even better than the above is to setup a local copy of your WordPress site on your own computer along with backup software such as svn.
That way, you can make changes locally without worrying about messing up your site, get them fully tested, and only then upload your changed files to your live site.
Doing so is beyond the scope of this site currently, but I will likely provide instructions on doing this down the road.










[...] and WARNING: Before making ANY changes to a theme, please read WordPress Theme Editing Best Practices. With the new built in editor to wordpress which uses color highlighting, a typo could break your [...]