Select Page

Creating a WordPress Plugin Downloader

How it Started

I was recently tasked with the challenge of creating a WordPress theme generator. The idea being, instead of writing your style.css file from scratch, you’d be able to just answer a few simple questions about how you’d like your theme set up, and those starter files would be automatically generated.

How it’s Going

Once I started diving into the specifics of how exactly to create a tool that would generate the files I was looking for, I realized very quickly that my scope for this project was perhaps a bit to broad. It ultimately had to answer the question, “What does this starter theme look like, anyway?”

In today’s fast-paced and rapidly changing tech environments, even the world of WordPress is looking at some pretty radical changes that forced me to ask the question, “FSE theme or Classic theme?” Because the files required to create even the most basic of themes would be different based on how the user answered that simple question.

Admittedly, the majority of the questions in this command-line program are just filling out various fields in the style.css file. And if you’re planning on making a parent or even a child theme, you’re going to have to fill that file out anyway.

And perhaps, that should be (or should have been) the primary objective of the entire tool. Essentially a stylesheet generator, and perhaps that can still be a web app down the road. However, in my ever-growing list of things I need this tool to do, was the ability to download the latest versions of various WordPress plugins from the official WordPress plugin repository.

This project ended up being a crash course on the finder points of Javascript async and await as I needed to figure out how to make a whole slew of HTTP GET requests in a specific order, waiting on responses from the first request before I could act on the second, and build it in such a way that it’s a modular set of download instructions that is easily repeatable for any WordPress plugin in the official repository.

I had an absolute blast on this project, there are still loose ends to tie up, and I’m probably going to continue messing with it at least for the next few months. I’ll need to remind myself to put a badge up if it gets too far out-of-date. If you made it this far, thanks for reading. If you’d like to try out my theme generator and play around with it, feel free to fork it on GitHub: https://github.com/mjones129/themegen

Check out more articles

Create a Custom API Endpoint in WordPress

Creating a custom endpoint in WordPress to check for plugin updates involves several steps. This process includes setting up a custom REST API endpoint, creating a function to handle requests to this endpoint, and ensuring that the response contains the necessary...

Deploy WordPress Updates from a Private Repository

To push code to a private repository and trigger a pending WordPress update badge, you need to follow a systematic approach involving version control, continuous integration/deployment, and the appropriate use of WordPress hooks and filters. Here’s a step-by-step...

How to Generate a Ranger Config File

ranger --copy-config=all This will copy all the default config files from /usr/local/lib so you can make edits without messing anything up. Huge shout out to https://dquinton.github.io/debian-install/config/ranger.html for explaining this and so much more. Took me a...

First Open Source Contribution

Surprise! I genuinely did not plan on making my first ever open source contribution today. In fact, I didn't plan on a lot of things happening this week at all. I recently got an awesome opportunity to work on a site that is being hosted on a platform called Pantheon,...

How to Exclude Specific Posts and Pages from WP_QUERY

For the sake of having something to work with, let's suppose we've got the following query:In this query, inside the $args array, there's a special parameter that allows you to exclude specific posts and pages from the query. This parameter is called post__not_in and...

Configure SSH For Password-less Connections

Preamble I'm slightly embarrassed to admit this, but it was a long time before I figured out how amazing this little file is and how exactly to put it to good use. The file I'm talking about is the SSH config file. By default, when you first connect to a server via...

WordPress Site Stuck in Maintenance Mode

Plugin Error Code 500 During Update While I was updating a WordPress plugin locally, something happened on my local server to trigger a 500 error code as the plugin was updating. On the frontend, I refreshed the page and was greeted with "Briefly Unavailable for...

Fix Audio on XFCE Chromebook

The Problem After moving from GalliumOS to Xubuntu, I noticed that playing YouTube videos on both Firefox and Chromium would result in decent playback for a few minutes, but suddenly the audio would turn into a solid beeping tone while the YouTube video displayed the...

Adjust Trackpad Sensitivity XFCE

xinput set-prop "Elan Touchpad" "Synaptics Finger" 1 1 1 What are the values 1 1 1? This sets the sensitivity as close to the original ChromeOS as possible. Larger numbers will decrease sensitivity of various aspects. I never looked into which individual value...

Fireworks (Short Film)

https://vimeo.com/395077249 About the film Year: 2020 Director/DP: Tim Searfoss Writers: Matt Jones, Tim Searfoss Sound Mix: Matt Jones

Looking for a place to host your next project or design?

Use this link to get your first 4 months of WP Engine for free: WP Engine – Plans (With 4 months free)