How to Update a WordPress Theme Customized without a Child Theme
This article will show how to update a WordPress theme that had its code modified without using a child theme.
Nowadays WP themes are very powerful and highly customizable. However even premium themes can not meet the needs of 100% of their customers. Popular themes like Flex Mag still need a tweak here and there.
Some people, mostly beginners, are not aware of child themes so they edit the theme’s files to customize their website. Which is a bad practice as they would need a manual and more complex way to update their theme to the latest version. If a few simple rules are kept, even manually updating the edited theme will not be a tedious process.
First of all any editing of the theme must be made using some personalized snippets. These snippets (or tags) must be uncommon, they are used to instantly find out where modifications were made. For example:
<?php /*start thm_edit*/ ?> and
<?php /*end thm_edit*/ ?>.
Next we create three directories: ‘theme’, ‘backup’ and ‘web’. In ‘theme’ we put the latest theme files and in ‘backup’ the current files on our website. At the beginning ‘web’ will store our current web site and will be used for file editing. In the end it will store the new version of the site. However if any mistakes are made we can go back and start over using our ‘backup’ files.
We will use WinMerge to loop to the files and make the necessary edits. Click on the File dropdown and select Open to get the Files or Folders to compare dialog. On the left panel we choose the ‘theme’ directory and on the right the ‘web’ directory. Make sure to uncheck Show Identical Files from the View dropdown. If there are files only in the theme panel make sure to copy them in the web directory. If some files are only in the right (web) panel and are not custom made by us we need to delete them: sometimes developers remove some files that are no longer necessary.
Next do a refresh (F5) and double click to loop through every file. Go to the Merge dropdown to loop through the differences in the files using Next Difference. Copy to right can be used to fix the current difference by copying the line on the left to the right.
However if things are missing in the left panel we need to delete them in the right panel as well unless we added them ourselves. After looping through every file and fixing the differences we can test the theme. If errors appear we will start over with the backup directory unless our own edits are to blame in which case we need to redo them.