Kids grow up and become parents, or at least stand alone adults, so what happens when a WordPress child theme can absorb their parent? Is this metaphor slipping down a slipper slope?
So here is the situation. Both my Daily Blank (a theme to create your own version of the DS106 Daily Create) theme and the DS106 Assignment Bank (one to create your own version of the DS106 Assignment Bank) were created as child themes of a basic WordPress theme built on Bootstrap, WP-Bootstrap that is not even online anymore or updated (I made my own fork because it needed one fix for a PHP issue).
Yes, there are newer basic, more modern bootstrap themes, but I never saw a problem/issue on the base one. And redoing is a big pile of work.
I have seen great iterations of other banks, like the UBC Open For Learning Challenges and the Middlebury Institute Tiny Gigs, that had been done up with impressive style make overs. Most likely this was done by edits to the child theme, meaning they were forever forked from updates.
The thought occurred to me long ago, but was not even tried until last night, that there seemed little reason I could not fold the child theme into the parent as a single theme (no danger of being stuck as the parent theme was never going to change).
And it turned out to be quite easy. I just made a copy of the parent theme, copied over the child theme files that were over-rides or additions. The one difference was all the custom code in
functions.php – I decided to put all of the ones from the child theme into a new file
functions-ds106bank.php and just include it at the bottom of the old parent’s
// Now bring on the custom stuff!
I also did some swappings to all style sheet and scripts that were enqueued using
get_stylesheet_directory_uri() to use the main theme directory via
get_stylesheet_template_uri(). The once exception was where the ds106bank theme’s custom CSS lives — I left this as
<!-- last and not least, the bank's own CSS -->
echo '<link rel="stylesheet" href="' . get_stylesheet_directory_uri()
. '/ds106bank.css" type="text/css" media="all">';
Without a child theme, this uses the version in the new standalone theme. This way, one could create a new child theme with it’s own copy and additions to
ds106bank.css for customizing.
There is a small trick to doing this theme swap I discovered the hard way- I tested out first on my local Varying Varying Vagrants site, but then just did this swap for the UDG Agora Challenge Bank
If you just replace the them, it gets into some weird recursive zone of the old and new themes fighting. So before replacing an old version of the DS106 Bank theme (done as a child), you should temporarily switch to another theme, like Twenty-Seventeen:
Then upload/replace the theme with the new version and once in place, switch back to the theme. Because it’s name and URL are the same, all settings are not affected.
The next little test might be do set up a version a a child theme… To Be Blogged (later)
I have zero idea if anyone beyond the ones sitting in front of my laptop cares about this, but it seems a more flexible solution for anyone intrepid enough not only to install the theme, but also to change its appearance. And this ay you get a few extra fixes I did to improve the preview forms for content submission that I rolled out yesterday for another SPLOT.
Children becoming parents? Outgrowing the needs for the parents? It does have sort of a foreshadowing precedent from the original DS106 Assignment Bank, the classic Boone Gorges Parent-Child Headswap assignment:
And heck, it makes for a fine way to swap Bava Blogger and Dog!
If they can swap, surely a WordPress theme can too.