-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic updates without losing customizations #252
Comments
Great idea! Currently I use the sample theme and have added a 'custom' directory containing our theme specific functions, stylesheet, js, etc. I have added 1 line the the sample theme functions.php to call the custom directory, but this does mean when updating the theme for clients we need to add the line back again. This idea to have update-able child themes has my support. |
I like this idea. I always use a custom functionality plugin so I don't have to edit the child theme at all. |
I do the same thing for my websites. Indeed, I have Zero problems with my updates. This works marvelously without changing the sample theme code. The customizations for all my personal websites are in a directory of the server that is linked in the sample them and 1 line added to the sample theme functions.php, to take my custom code from that linked directory. Of course, if I move the sample theme from a directory to another one, the link to the directory with my custom code remains. |
The StudioPress team have discussed automatic updates for child themes, but so far we haven't found a guaranteed safe way to implement this that doesn't potentially jeopardise live sites upon update. Speaking only for myself from here on, albeit informed by discussions I've had with other StudioPress team members. I like @seothemes' test project. Thank you for putting it together and starting this discussion. I can see it could work for minor theme customisations and minor updates, and the auto-backup mechanism is a nice touch to give people a way back out. I think this is the best implementation of child theme updates I've seen so far. But some general issues still remain, and I hope you won't take offence at the long list here. This is not specific to your implementation; I'm just sharing considerations we've run up against when discussing child theme updates in general: Challenges with self-updating child themes
It's easy to say in response to many of the above points, “well, site owners can just revert to their theme backup if something goes wrong”. But then what? The customer probably still wants the theme updates they paid for. Support teams and developers must figure out why the update went wrong and offer a way forward that does not undo any customisations the site owner wants. This drifts from the realm of support to site customisation. I don't mean to be entirely dismissive of auto updates. I recognise that they would help theme developers in some ways, and it feels like a potential improvement on the current suggestions for customers to “just diff your current theme version with the new version and re-apply any customisations manually”. But we need to consider that people will be updating the live sites for their customers and own businesses and expecting it to just work, the same way WP core and plugin updates are supposed to. We need to be careful not to further erode trust in the WordPress update system by claiming to be able to automatically update a codebase consistently that could be in a wide variety of unknown states. The update systems for plugins, for Genesis, and for WordPress core all assume a known state. And those updates still break sites from time to time. Having spent some time with this problem, it seems possible to me that any system for self-updating child themes that could contain user edits cannot claim with an acceptable level of confidence to update your site without breaking it. So what instead? AlternativesWe have a few other options:
I think there's potentially a better option than both of these, and it's one that I can't take credit for — it emerged from discussions with the StudioPress team: Let's work together to reduce the amount of code in child themes that requires an update in the first placeThemes have too much common logic and styling in them at present. They are supposed to be simple styling layers, but they're an increasingly large mess of logic, heavy CSS and JS. As a community, we can work to undo some of the complexity that is common to all child themes. Work has already begun in the upcoming Genesis 3.0 (which introduces a new menu component hosted by the framework). But we can continue this in two ways:
The advantage of both approaches are that:
The disadvantages are that Genesis potentially grows in complexity if we don't govern it carefully, and that theme developers still don't have a mechanism for automatically updating child theme CSS and PHP. However, given the choice of (a) reducing theme complexity while ensuring better stability at the cost of automatic child theme updates or (b) offering minor design and feature updates at the cost of potentially remotely wiping out sites en-masse, I'd opt for the former. The direction StudioPress takes with child theme updates isn't set in stone yet, though. It also needn't affect community child theme developers, of course. Please feel free to continue to experiment with these ideas — I'm really interested in tracking them and seeing the results. |
@nickcernis Wow, thank you for taking the time to write all of that. Some great points there. Not saying that this approach is the only way to go but I would like to attempt to address some of the points above: Challenges
This is true, but that can also happen with Genesis itself. There is nothing stopping people from editing Genesis core files or even plugin files. If they do that, they are aware of the risk.
This is a general backwards compatibility issue. Child themes would need to make backwards-compatible changes like any other theme or plugin. This issue also occurs with manual updates and "engine plugins" unless the developer enures backwards compatibility.
Users cannot edit Genesis directly but can customize everything with hooks. Child themes should be built the same. Even without automatic updates, I don't tell users to edit the child theme. Instead, customizations should be placed in a custom functionality plugin.
The automatic backup feature allows this. If the update breaks anything they can simply rollback to the last version. For an advanced preview they could use something like Staging Pilot.
I'd say this is better than the current situation. I'd rather push an update to fix 1000+ sites than have to answer 1000+ support tickets for the same issue. In my opinion, the support burden is always going to be decreased by having automatic updates.
This is probably a good thing. Content is separate to code and should never be updated. That being said, they could always run the demo import again to create a new home page with the updated content.
Agreed, I think there should be a popup notice before proceeding with the update telling the user to create a full site backup before running the update. Like WP Engine hosted sites currently do. In the example project I created, the update will not run if the backup is not successful. With some more testing I could almost guarantee that this is safe.
There are plenty of existing solutions - EDD, Freemius, Plugin Update Checker. I'm sure most third party developers would be more than happy to do this considering the benefits that automatic updates would bring. StudioPress could just use something similar to what they already have with Genesis. Alternatives
There is always a risk when updating themes and plugins, child themes are no different. It's actually safer than updating the latter because of the built in backups. If the backup fails, then the update is stopped.
This is a possibility, checking that the
This is great in theory but it will never work. There are always going to be bugs and new features in child themes. Until Gutenberg replaces the need for theme frameworks like Genesis, child themes will always need more complexity than Genesis can provide. Relying only on what Genesis provides is really limiting to developers and means we can't give users the features they want. By the time Genesis could provide this amount of functionality, it would be almost obsolete because of blocks/Gutenberg. Themes will probably be reduced to a single stylesheet in the near future. The real problem with this is solution is that child theme CSS can't be provided by Genesis. This is the main thing that requires updating. Other optionsThe only other real option is to use an engine plugin. Below are the downsides to using engine plugins vs auto-updates. These are the things that have stopped me using engine plugins in the past. Please note that this is my opinion only:
Ask the communityI think it would be a cool idea to ask the community what they think in a survey. It would need a quick video demonstrating each of the options. It could be something simple like this: Should Genesis child themes introduce automatic updates. If so, what is the best approach?
If enough people were on board with the idea, then it might be worth looking into. |
This is a great convo, thank you all.
I want to add a caveat to that statement as updating CSS is generally not our problem. Customers don't need CSS updates. However, updating custom WooCommerce templates is a massive problem and customers DO need those. Other templates for other plugins too, but mostly WooCommerce. That is why we need customers to be able to update their child themes more than any other reason, every month it seems Woo releases a templates change and throws "Your templates could be incompatible!!!!!". Those sorts of thing is never going to make it's way into Genesis core. As others have said (and Mai to their credit have done) there is the option of moving that code into a plugin. We considered that, and need to again with G3 not being turned into a plugin. However, if the engineering effort to turn G3 into a plugin is too much, it's WAY too much to ask that every single child themes do it instead. |
@jb510 Good point about plugin templates. That is another big one. I noted CSS as the main reason due to all of the changes with Gutenberg, most themes needed an overhaul to include block styling. But I agree, in some cases it would be templates or logic that require the most updates. Since it has been confirmed that Genesis won't become a plugin, there are only 2 possible ways (that I can think of) to provide automatic updates going forward:
We should discuss on the pros and cons of each and try to reach an agreement for the best possible solution. So far, the solution from StudioPress/WP Engine is to reduce the amount of code in child themes which is a good long-term goal but it doesn't really solve the problem. |
Just wanted to start a conversation about the possibility of having automatic updates in child themes.
In the past this has been a bad idea because people like to place custom snippets in their child themes and there is no way to avoid overwriting them, but I think I've found a solution.
The idea is to place all of the child themes code in a non-editable folder. During an automatic update, this is the only folder that is changed, all other files outside of this folder are not touched.
For additional safety, a full backup is made of the original child theme version before running the update, just in case.
I've recreated Genesis Sample with this functionality built in. If anyone wants to test it out the project is available here. See the readme for full details.
So far I haven't found any downsides but I would like to hear others thoughts.
The text was updated successfully, but these errors were encountered: