Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.


i updated my wordpress in 3.1 (i'm using twenty ten) and some of my code has been deleted, i'd like to understand it : is it only because i'm using the "twenty theme", that the "code" was replaced with the new version? does a "new version" remove also the code if i use my own theme? and so : to have a code safe, the "plugin" folder is the only safe area?

I'd like to be confident the next time i update my version of wordpress.

Thanks

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

At the moment, WordPress replaces core files when it updates. This will change in the future, but for now all core files get replaced, i.e. every file that comes with WordPress. This includes the default twenty ten theme.

If you modify twenty ten you should save your modified theme with a different name. To do this, make a copy of the twentyten folder and rename this folder. Then, inside the renamed folder open styles.css and change the line Theme Name: Twenty Ten to Theme Name: Same Name as your Renamed Folder. Add this folder back into wp-content/themes and activate it in your admin settings.

When WordPress updates it leaves your own themes alone, so you won't lose the changes you made.

share|improve this answer
    
Thanks ! –  Paul_p May 29 '11 at 16:43
add comment

I wrongly assumed that @Elpie meant to make a Child Theme.

Therefore my answer now becomes that I suggest making a Child Theme of Twenty Ten to a. protect your changes for future updates and b. still have all the benefits that Twenty Ten offers now and in the future.

To do so, you will also need to duplicate the twentyten folder and give it a different name. You also need to change the top part of the Twenty Ten style.css

  1. In the top of your style.css you will need to tell that you still use twentyten as the parent theme. So you will need to add a line: Template: twentyten

  2. Also at the top, but under the initial code you should import the twentyten stylesheet. You can do that by using this line of code: @import url("../twentyten/style.css");

Eventually the top of your stylesheet should look similar to this:

/*
Theme Name: Twenty Ten Child
Description: Child theme for the Twenty Ten theme 
Author: Your name here
Template: twentyten
*/

@import url("../twentyten/style.css");

All this and more on Child Themes in the Codex: http://codex.wordpress.org/Child_Themes

share|improve this answer
    
I don't think Elpie was talking about a child theme. I think it was more of a "duplicate the entirety of twentyten" recommendation. –  John P Bloch May 29 '11 at 15:21
    
oh ok, well then I will have to change my answer... –  Piet May 29 '11 at 15:27
    
Your answer's a great answer, since this is exactly the use case they were designed for. Maybe just modify it not to say "Do what Elpie said plus this", but rather "Another cool way to do it is this:" –  John P Bloch May 29 '11 at 15:31
    
Thanks for the answer! –  Paul_p May 29 '11 at 16:43
2  
Agreed, child themes were designed for this. Child themes have been available, in one form or another, since the very early WordPress 2.x releases. The current implementation of child themes has been around since 2.7 yet a lot of people are still modifying the theme itself. It's great to see both answers here so people can choose which suits their needs best. –  Elpie May 30 '11 at 7:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.