Earlier this week Matthias Pfefferle released an update of the Sempress theme I use as a basis for this site. I clicked install in my WordPress dashboard, and then my site became unreachable. I mentioned it in the IndieWeb IRC/Slack channel for WordPress and Matthias kindly offered help in figuring out the issue. He found a small mistake on his side, which he quickly corrected and updated, and he spotted a few differences between my child theme and his original. But it didn’t solve the issue. So I left my child theme turned off, and ran Sempress proper, with the idea I would make time to compare my child theme alterations with the original later in the week. Then I slept on it and the next morning I woke up with the notion that I had changed some function in the original Sempress theme, for my child theme to work.
That turned out to be the issue. I copied and tweaked a function, that then in the original Sempress file should be wrapped in a conditional statement that checks if that function isn’t already loaded (as the child theme gets loaded first, then the theme). When a function gets loaded twice it causes a clash. Precisely that function isn’t wrapped by default in a check if it already exists. So I added if (!function_exists(sempress_customize_css)):
and all was well again.
Unlike last time, this time I documented that I need to do this after an update of the Sempress theme. (Or suggest a change to the original.)
In reply to https://www.zylstra.org/blog/2020/09/reminder-to-self-document-stuff/.
Just the other day I was a bit disappointed a Twenty Twenty function was not pluggable like that. I worked around the problem by copy-and-pasting the function into my child theme, making the necessary changes, giving it a new name, and then creating child theme versions of the—only two, luckily!—templates that called it, having them call my version instead.
It is now part of SemPress, so no further update should break it again: https://github.com/pfefferle/SemPress/commit/c6ffec09b1a4de67489d5db381f1429d4745f461
Feel free, to suggest such changes on the GitHub repo or simply ping me in the IndieWeb WordPress channel.
I am glad you like/use the theme 🙂
Thank you Matthias for making that change in Sempress, and your kind assistance.
@ton this is a good reminder, I do a better job of documenting stuff at work than home, but will keep trying…