DIY WordPress Plugin Tutorial - COVID-19 Isolation and Quarantine Calculator

DIY WordPress Plugin Tutorial - COVID-19 Isolation and Quarantine Calculator

ยท

5 min read

Getting Started

Hey there! If you're just stopping by, check out my previous WordPress plugin tutorial to see the base of this code that dates back YEARS. It's so simple, but it's a really awesome base that I encourage you to snag, slice, and dice as you see fit!

Live Demo: https://demo.md-wv.com/covid-19-isolation-and-quarantine-calculator/
(Full code available on GitHub at link after article.)

COVID-19 Isolation and Quarantine Calculator

Disclaimer: During the day, I'm a population health planner, health equity hero, and data nerd. I am not a doctor, and this is not medical advice - consult your primary care physician for that. Also, COVID-19 is really taxing our public health folks, so please take a moment to reach out to your local health department with a few words of encouragement. Many of us have been working tirelessly since February/March to protect our communities, and a few kind words goes a long way. ๐Ÿ˜„

Now, let's get started!

Define WordPress Plugin Header Fields

Defining WordPress plugin header fields becomes super easy after two or three plugins. I often re-use my old code, and update it each time I'm deploying a new plugin header.

Create WordPress Plugin Options

Creating WordPress plugin options in the WordPress admin dashboard is actually way easier than you'd think - especially with tools like wpsettingsapi.jeroensormani.com that make it sooo super easy to generate WordPress options using the new-ish API.

Change a few standardized variables, add a dashicon, and toss in a text area (we love the ability to customize plugin output), and you're ready to roll on the admin side.

Create WordPress Plugin Function

This is where the ๐Ÿ’ซ magic happens haha. When I set out to make this project, I really thought it would be much more complex. Instead, I chose to make something simple that could be easily deployed, didn't depend on any external libraries, and worked well on all devices - especially mobile phones. So yes, I chose PHP over js - sorry fanboys. ๐Ÿ˜‰ This choice made it extremely easy to append dates with additional days, and allowed me to process the values using a simple form - totes easy. ๐Ÿ

Create WordPress Plugin Shortcode

Ok, I am someone who never ceases to be amazed when it comes to shortcodes. I love having TOTAL control over where my plugins deploy and where they can be active. Making the short code is just the icing on the cake. ๐ŸŽ‚

Download the Final Plugin

That's pretty much it. ๐Ÿ˜„ I continue to be a huge advocate on two fronts: re-use your old code (economies of scale and such), and don't make things more complicated than they need to be. Right now, the world is spinning ever faster, and we need solutions NOW. I'd love to remake this in javascript with Tailwind or another smooth library, but people need this today. Just my thoughts. Please feel free to slice and dice my code - I'm a marketing nerd and health equity warrior by trade, not a developer, so I always appreciate ideas to improve my code. Thanks for stopping by!

https://github.com/heyjohncorbin/iqcalc

Original Post: DIY WordPress Plugin Tutorial โ€“ COVID-19 Isolation and Quarantine Calculator