Working With WordPress, Requires Some PHP Skill

Come to grips with the basic operation of the PHP language, and get a leg up on the competition, when working with WordPress template files.

WordPress renders from template files in a certain order, based on the filename. This type of override can lead to high search times when attempting to locate the specific template file required to produce the requested change. When working with PHP template files, one ought to first make a small test and check through the browser to verify.

After one confirms the correct file for editing, proceed to the alterations. Optionally, backup the original file in case it gets FUBAR’d. Next, make edits incrementally, and continue to check the rendering in your browser. If something breaks, you can likely undo your changes to a known good stasis. The sooner one knows that the page fails to render, the less backtracking required. Again, test as you go and proceed in small steps for best results.

Use a Child Theme, Don’t Edit the Parent Theme

Now, damage to theme files gets minimized by proceeding carefully, but let’s step back for a moment. Should one edit the theme files directly? No, one should edit using a Child Theme. If not familiar with the creation of a Child Theme manually, several plugins exist to automate the procedure. Essentially, WordPress will use the Child Theme files to override the Parent Theme files. If no override gets detected in the Child Theme directory, the Parent theme file gets used instead. This allows you to update the Parent Theme without overwriting customization.

Updating the Parent Theme will not always leave customization in place. For instance, changes to the Parent theme may not jive with the old method of customization. So, as commonly occurs, an update will appear to render correctly, while for visitors a few small bugs appear. These ‘new’ bugs can get difficult for the contractor to detect. A contractor does not operate with the same intimate familiarity of the site, like say, the owner or recurring visitor.

You may also like...

Leave a Reply