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 functions.php:

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

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

A site built on the Assignment Bank theme, this was how it looked before and after the swap

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:

The UDG Agora Challenge Bank does not quite do the same thing in 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:

The example image provided for this assignment, a swap of Boone and his then infant son Wally

And heck, it makes for a fine way to swap Bava Blogger and Dog!

If they can swap, surely a WordPress theme can too.


Featured Image:

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Comments

  1. I was trying to figure out why I thought I’d forgotten how to make a child theme and the switching of themes in between was the key.

    So just more compliments for making nice things and documenting them online!

Leave a Reply

Your email address will not be published. Required fields are marked *