How to build a child theme from a modified theme/stylesheet
-
If, like me, you didn’t start working on graphene’s modifications using the child theme, and you’re now wondering how to update the theme without loosing all your hard job, then this article is for you. First of all, we are about to back trace the modifications made to the theme. To achieve this task, you will need:
– Sadly, a Windows PC (i didn’t find the right tools for Linux or Mac)
– Original graphene package of your installed version: i obtained mine by copying the actual graphene download link from wordpress.org themes directory: http://wordpress.org/extend/themes/download/graphene.1.5.6.zip then i changed the version numbers to 1.4.1, put the link back in the browser, and i got the needed graphene.1.4.1.zip
– An actual copy of the online graphene folder where you made the modifications
– The shareware tool Total Commander
Download and install Total Commander, choose your language and open it up:
In the left pane, select the folder where you unzipped the original graphene package
In the right pane, select the folder where you put the copy of the online modified graphene installation
In the top menu of Total Commander, select Commands and then Synchronize Dirs.; Select all options but “Asymmetricâ€.; in the “Show†section Select the two symbols unequal and unique on the right. Now click Compare; DON’T CLICK SYNCRONIZE. As you can see in the screenshot, the program shows the different files (the ones that you modified in your graphene installation) and the files unique on the right; here you may find original files that you may have backed up before making modifications (like my footer.php.orig) or even new images you may have uploaded and referenced in your custom php/css (like my sprite_personal.png).
Right now, we are gonna focus on plain text files, like php and css.
On every “different†text file, you are gonna right click and select “Compare left and Rightâ€.
Such a window will popup, with different lines and differences in the line shown in red.
You are gonna evaluate every modification made in plain text php files. In my case there was just some translation relative modifications, and it was easy for me to take a note for every file, like “archive.php lines 25, 27, 31, 33, 35 translationâ€. I did this for every php file. Then i had to face the case of the modification i asked Syahir in this post. Such modifications should be manually restored every time you will update the theme, because, as far as i know, they’re not supported in the child-theme.
The modifications made to the css and eventually added functions in the functions.php file should be copied and pasted in the child-theme files, read this post for full details. To build this files, i suggest you to use Notepad++. After building your child theme’s directory of you current graphene version, you are now safe to upload the original functions.php and style.css to the online graphene folder. Then you should go in the wordpress panel and switch from graphene to the configured child theme, and your site, if you did everything fine, will look exactly as before! You are now “safe†to update graphene. I mean that you should always bring modifications made to the archive, loop, header, footer, and other themes files not supported by the child theme back to the new original graphene installation.
In my case, after upgrade the notes taken from the file comparison described above became useful to bring my modifications back to the new 1.5.6 installation.
HUGE +1 !!
This will come in very handy to a lot of people. Great explanation, nice screenshots, and detailed instructions.
Thanks for the contribution!!
Wow! Great post! This can certainly help the newbies to theme modifications.
However, a small doubt. Why did you mark this thread as not resolved?? 🙂
Mod
Changed to “Resolved” — although for many, this will be but the beginning…
Mod
then i changed the version numbers to 1.4.1, put the link back in the browser, and i got the needed graphene.1.4.1.zip
Check the version number in your stylesheet — this will only work if you are using 1.4.1. If you are using a different version, you will want to change to the appropriate version number here.
Mod
Should this be stickied? Opinions?
Should this be stickied? Opinions?
I think so..
Absolutely. (Has anyone been following along on my suggestions for a “Hall of Fame” for graphene sites?)
Edit: Can we make a sticky thread in the showcase forum?
Mod
Has anyone been following along on my suggestions for a “Hall of Fame” for graphene sites?
Might need some sort of polling software–not sure if bbPress could handle this. But definitely a cool idea. Kind of like the Oscars for Graphene.
Can we make a sticky thread in the showcase forum?
Technically possible — or do you mean, is it okay with Syahir?
Haha.. both, I suppose. I do love the poll idea.
Viewing 10 posts - 1 through 10 (of 11 total)
- 1
- 2
- You must be logged in to reply to this topic.