I am using a Genesis child theme that I would like to make some custom changes to it, but would like to be able to update it when a new version comes out without loosing my edits. I am familiar with the parent-child practice, but since my theme is already a child of genesis what is the best way to approach that?
First, I tried to make a parent-child-child theme, but not only some of the markup is different, but I also lost all my widgets sections from the parent-child theme.
-created a new directory with a style.css and have this code:
/*
Theme Name: parent-child-child
Template: genesis
*/
@import url("../parent-child/style.css");)
Next, I copied all files(functions.php, Template files, other…I only kept the style.css from my first try) from my parent-child theme to my parent-child-child theme and it worked, but I am worried that the code from functions.php is going to be loaded twice and therefor slow down my website or even break it down at some point.
What would be the right way of dealing with this problem?
Thanks,
Radi
Genesis (and others like it) has always had a problem with a lack of consensus on how to cope with updates to its child themes. The simple conventional answer is that you should seldom or never update them, because it may be a very time-intensive process to avoid breaking things. StudioPress does not do auto-updates for child themes anymore, so you have to go out of your way to follow the updates, get them, and merge the changes into your existing child theme. If you do this through a git repo you can automate and manage it rather simply and well. But even if you are doing that, why make things any more difficult than necessary?
My advice:
DON’T make m/any changes to a Genesis child theme. The fewer changes the better, preferably zero. Then you can run updates to it without worry.
DO all your customizations in additional CSS outside the child theme. Add it to the Customizer if you like, just back it up carefully or lock out people who you don’t want touching it.
If you are switching between parent/child themes your widget and customizer settings will not carry over between them. You need to use import/export plugins for that.
If you are making your own Genesis child:
DO use the enqueue method to include styles. ð Covered in this good tutorial on the 2017 core theme.
DON’T copy the parent theme’s
functions.php
or template files. If the same function is loaded twice it will throw a big error right away.functions.php
with additional code in your childfunctions.php
. This is explained in the “Usingfunctions.php
” section at the end of this excellent article. This is also an outstandlong long introduction to coding a child theme today.From my understanding, there’s no grand child theme in current version of WordPress. It’s not supported at the moment, but I heard that WordPress will support in future version.
So, if you make change directly to your child theme and upgrade, all your changes will be gone. To keep your changes, you can do like this:
Whenever your original child theme is updated, you should look at its changlog and scan files for changes and apply them to your new child theme.
In theory;
I’ve been looking at this issue too. So far I know you can create a plugin, then replace a certain page within the the theme by overriding it, using the themes template name, with a custom page within a plugin. Unfortunelty, I cannot find a way to just add one using the plugins directory.
Hope this bit helps.