blog, A personal WordPress MonoRepo for my themes and plugins
https://shkspr.mobi/blog/2024/03/a-personal-wordpress-monorepo-for-my-themes-and-plugins/I use a self-built WordPress theme for this blog. I also use a variety of self-developed WordPress plugins for various enhancements. I used to publish these plugins, but I get terribly confused by the SVN shenanigans involved, and they weren't used by many people, so I stopped.
Recently, I've been moving all my plugin code into my theme. This is sort-of-but-not-quite a MonoRepo.
I've also tried to move away, as far as possible, from using other people's plugins. Most of the ones I had were single-shot plugins which did one thing and needed the minimum amount of configuration. So I learned from their code and re-implemented it into my theme.
This isn't quite digital-homesteading. I'm not rolling my own crypto, or building my own CMS. I'm just taking back a little control, learning how things work, and enjoying the busy-work of Digital Gardening.
I don't know if this is a good idea. It means I don't get security updates if my knock-off code is vulnerable. I don't get new features. But I also don't have to trust that a 3rd-party developer isn't going to screw up (I can screw up on my own, thank-you-very-much!). I've had a few bad experiences with plugins which suddenly stopped working, or had abusive behaviour.
HowTo
I put new functionality into a file with a descriptive name, for example
related-posts.php
and I save it inmy-theme/includes/
.In my WordPress's theme, I add this to
functions.php
:// Load all the files$includes_path = get_template_directory() . "/includes/";foreach ( new DirectoryIterator( $includes_path ) as $fileInfo ) { if( $fileInfo->isDot() ) continue; // Ignore . and .. if( $fileInfo->getExtension() != "php" ) continue; // Only load PHP require_once( get_template_directory() . "/includes/" . $fileInfo->getFilename() );}
That loads all the
.php
files from/includes/
.I have no idea how performant this is. I have some fairly aggressive caching plugins which should minimise any slowness - and they're not part of my MonoRepo.
https://shkspr.mobi/blog/2024/03/a-personal-wordpress-monorepo-for-my-themes-and-plugins/