Never directly modify the Theme template files for a Theme that you don’t control. If it updates (not when WordPress updates, but when the Theme updates), then yes; you’ll lose your changes.
Always make such changes in a Child Theme.
@ Chip Bennet
Thanks for your response.
Now with hindsight I realize the ambiguity of my question.
But first a clarification. I’ve not modified existing page templates, only added templates based on existing templates. These new templates have been added to the theme folder. I made the assumption that storing additional page templates in the main theme folder was appropriate but based on your comments perhaps additional templates should always go in a child theme?
Anyway if my assumption is correct then I was wondering if the process of updating WP would erase any new page templates that were added to the theme file. Or does this only occur when you update a theme?
Another reason I ask is that I’m about to upgrade WP to 3.1 and even though a backup would save me I would like to anticipate any changes I need to make with regard to where to locate the page templates.
do you use the twentyten theme? That is the only theme which would get erased on a wordpress upgrade…..never edit that one
any other theme, you control. Still a child theme is a good idea, if the theme is actively developed and updtes become available
@ Rev Voodoo
Thanks for your response and for the link.
I have a couple of blogs, one uses twentyten theme.
I have some page templates added to twentyten theme and so it sounds as though I should move them to the child theme.
But to conclude it would seem that the best practice is to put new page templates into the child theme even though its not always necessary.
I think you pretty much understand how things work.
The reason that storing additional page template files with the original Theme is a bad idea is that the upgrade process deletes the current theme directory, and then unpacks the updated Theme from the ZIP file, and writes the directory in wp-content\themes\ again. So, your additional template files would get deleted with the rest of the Theme files.
I would counter that users still don’t control any other Theme, unless users choose not to update their Themes, which is generally not a wise decision, and subverts one of the most powerful features of WordPress (automatic – or, at least, one-click – update of core, Themes, and Plugins from the WP-Admin).
@ Chip Bennet
Thanks so much.
Its always helpful when stumbling around in the dark to know that you are headed in the right direction.
@chip Bennet: Yeah I’d agree the wording wasn’t the best. Was trying to differentiate between losing changes on a WP upgrade vs. a theme upgrade.
I think more and ore, themes are being maintained, and will be upgraded….whereas in the past, a lot of themes seemed to be one shot deals. They would be made, released, and forgotten about. So basically, child themes are always the way to go.
- The topic ‘Best Practice For Page Templates’ is closed to new replies.