GitHub is a great place for open-source projects. I practically have every one of my WordPress projects on there made public. GitHub is also great for creating your own custom plugin updaters to fetch code from a GitHub repository but this time, I wanted to know if one could be done for a theme.
Brad Griffin just happened to have the same idea in doing this for the official WooCommerce WordPress theme Storefront but he had a different approach. I thought this was a great opportunity to take the challenge in creating one myself.
However, the code for Storefront on GitHub is organized a little different than how WooCommerce is on GitHub.
So I teamed up with both Brad Griffin and James Koster who is the main developer for Storefront to develop a plugin which overrides the source of the theme location and instead detect new releases of Storefront from the GitHub repository instead.
Now the first version of the beta tester plugin was done quite quickly as it was mostly forked from the WooCommerce Beta Tester plugin with some configurations tweaked to connect with the GitHub repository for Storefront but until the first beta was actually released, we had no way of knowing it was going to work.
After Storefront 2.0 Beta 1 was released I was able to test it in action. The smile on my face was gone instantly as a major issue was obvious. It was not working, at least not fully anyway.
Honestly, I would have been surprised if it had worked with no problems the first time round but the true is that themes update a little differently to how plugins update within WordPress.
So I went looking for the cause of the issue and I found more than one. The main issue was being that the data from the GitHub repository was not returning fully which is needed for the plugin updater to work. Only a partial amount of it was returning which I found a little odd but once that was fixed the API checker then needed adjusting as WordPress reads it a little differently.
One filter that was not needed was disabled and a depreciated function for returning theme data was replaced with the correct function. Checked the update page again for Storefront 2.0 Beta 1 to show and there it was.
I selected the theme and pressed the update theme button. It worked. My smile returned. 🙂
I pushed the corrections to GitHub and now developers can download the beta tester plugin to download any new releases of Storefront rather than WordPress.org
Please ensure you test responsibly, it’s not a good idea to run beta versions on a production site unless you know what you’re doing!
Happy testing! 🙂