When I do my programming, I work from home. So self-quarantine hasn't changed that part of my routine very much.
In the spirit of people who may be out of work and looking for something to do – or maybe just getting to the point of being bored out of your skulls – I thought it might be interesting (or at least a way to pass the time) to screen record a bit of coding from a real-live project I've been working on.
This site I'm building calls for images on WordPress archive pages. Previously, I'd hacked a plugin downloaded from the WordPress Plugin repository to do the job, but hacking a plugin gets you in trouble when updates come down the pike. I needed a better solution.
In this series of videos, I add a few custom fields to the WP Customizer, making it easy for the site's end user to select a new image and eliminating the need for the extra (hacked) plugin.
Adding customizer settings and controls, but then things go sideways.
Fixing the Image Controls:
If at first you don't succeed, read the directions. With a look at the class signature for Customizer image controls, we get things working as expected.
Making it show on the Front End:
Now that we can upload and choose the images we want, we need to make them show up on the archive pages.
The job's not done yet. The method we're using to show our images works, but it's messy. Refactoring to reduce the number of
ifs makes it easier to read and more efficient.