• Resolved dorich

    (@dorich)


    My question is, will customized page templates stored in the main theme folder be erased when you upgrade WordPress?
    If so does that suggest that the best practice is to put new page templates in the ‘child theme’ folder?

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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.

    Thread Starter dorich

    (@dorich)

    @ 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?

    I’m just learning about child themes – only because I wanted to load different Javascripts to different pages. If I understand correctly this creates a problem because when WP upgrades it will overwrite the theme returning the theme files to the original state and hence the changes to header, where I placed links to the scripts would be lost – but perhaps I misunderstood and this only happens if the theme is upgraded?

    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.

    Thanks.

    do you use the twentyten theme? That is the only theme which would get erased on a wordpress upgrade…..never edit that one
    http://go.rvoodoo.com/WPchild

    any other theme, you control. Still a child theme is a good idea, if the theme is actively developed and updtes become available

    Thread Starter dorich

    (@dorich)

    @ 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.

    Thanks.

    @dorich:

    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.

    @rev. Voodoo:

    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).

    Thread Starter dorich

    (@dorich)

    @ 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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Best Practice For Page Templates’ is closed to new replies.