tags:

views:

43

answers:

5

I just started using Wordpress 3.0 to get a simple blog up and going. For now I am working with the default theme "Twenty Ten".

I want to make a simple change:
I'd like to modify the layout of the bloginfo( 'name' ), bloginfo( 'description' ), and php header_image() that appears at the top of the blog.

So, under Appearance, Editor, I select Header.php and I can see how this is being rendered.
It appears I can just modify this to my liking and I am good to go. (Correct?)

If so, my question is: is it considered proper practice to modify the html in header.php?
It seems to me that this is a bit dangerous, for example when it comes time to upgrade that same theme. How do I know which php files I have applied customizations to? Say I modify 6 php files, then an upgrade of the theme comes along...how does one handle re-applying these changes to the upgraded theme?

Is it a total "do over"?
Is there a better way to handle this scenario?
Maybe some themes are more powerful than others and can handle this type of customization more flexibly, and I should be searching for such a theme? Or, is there a reasonably proper and safe way to do this by directly editing the php files?

A: 

Yes, you can edit the theme to your liking. I think it's common practice (however, I've always just created my own themes from scratch). Just give credit where it's due and don't pass it off as your own original work.

To avoid over-writing your customized theme when an upgrade comes out, you could save the customized one to a different folder in the themes directory with a different name, like Twenty Ten Customized. You can then copy or re-do the changes in the upgraded theme if you think the upgrades are worth the trouble. There's no rule that says you have to have the latest version of the theme, after all.

There might be other themes that allow a high degree of customization without editing the php, but most of the time you'd have to edit the php I'd think. (but I'm no pro theme developer.)

Benny Jobigan
Hmmm, ok. Question: "save the customized one to a different folder in the themes directory"..."You can then copy or re-do the changes in the upgraded theme if you think the upgrades are worth the trouble."I suppose I could do a "diff" between the two folders and files (original vs customized) to determine which files I changed and in which way....and then one would have to redo the potentially "hard" work of re-modifying the new theme. Certainly a workable solution, but not ideal. I wonder if there's a *better* way?
tbone
The other thing to remember is to change the theme name in the theme css header so that you can tell the copy from the original
Kris C
This is way more work than it's worth. You'd have to go through and modify ALL the l10n strings' textdomain so that the string worked, or remove the l10n functions altogether. Best bet is a child theme.
John P Bloch
A: 

I would do as Benny suggested and rename the theme so that it isn't overwritten when you upgrade Wordpress.

I would not worry about updates to the actual theme because I don't think those ever really happen. The last Wordpress default theme was Kubrick and, to my knowledge, it rarely was updated and most updates were minor and went unnoticed by most users. If you go about customizing your theme, I don't think Wordpress is going to update the Twenty Ten theme to the point where you would ever wish that you hadn't edited the source because you wanted to upgrade to the new default theme.

If you don't want to actually edit any of the theme files, check out something like Thesis that allows you to customize most things from the admin.

Note: I'm not aware of a free theme that offers a lot of customization options through the admin panel, but there might be something if you check around for a while.

Chris Schmitz
A: 

If I really had to stop automatic updates on my Wordpress theme, I'd do exactly what Kris + Chris Schmitz suggested (i.e. rename the theme differently). Modify header information in the style.css file in your theme's root to do this.

Personally, however, if the theme already works for me out of the box, I think I'd most probably already be fine with that. My website's running, the theme's working, and updating my theme may just break my site in ways I don't know.

I'd probably update it only for major security updates, but I'd probably be reading a changelog for that. But if I was doing that, I'd know what files exactly were modified, and I can just manually do it myself. Sounds like a lot of work, but better than my site buckling on me by some unknown cause.

Richard Neil Ilagan
A: 

If you do as Benny suggests and create a renamed copy of the default theme, you can use a free diff tool to compare the directories when an upgrade comes out. I'd use Meld ( http://meld.sourceforge.net/ ) to do a three-way directory comparison (Original theme, upgraded theme, modified copy) to determine if any changes have been made that impact the parts you changed, as well as to merge the upgrade changes into your modified files.

Curtis
Cool, 3 way comparison tool, nice, thanks for the tip!
tbone
The biggest thing in Meld is that you can EDIT the files at the same time. Very powerful. "Beyond Compare" is even more powerful, but it's not free, and doesn't have an OSX version.
Curtis
+2  A: 

Child theme, child theme, child theme. Create a new folder in themes (name it whatever you want. Go crazy. As long as you don't name it twentyten). Create a style.css file in that directory and copy the whole style.css file from twentyten into it. Then, change the theme name in the css headers and add this line after the tags:

Template: twentyten

Then copy the header.php file over to another file in your directory, and edit to your heart's content. If twentyten ever gets updated, you'll get the benefit of those updates (unless they're in css or the header) without losing your changes.

John P Bloch
+1 - it's what child themes were designed for!
TheDeadMedic
Thanks TheDeadMedic! I should also add that you can then 'replace' any file in the parent theme (template) simply by creating that file in the child theme's directory. The one exception to this is the functions.php file. WordPress will use both, loading your child theme's functions.php file first, then the Template's file.
John P Bloch
+1 cool. I didn't know there was such a thing as child themes.
Benny Jobigan