DEV Community

MD SAYEM
MD SAYEM

Posted on

How I built 70+ free calculators inside one WordPress plugin

I run a small calculator site called PureCalculate, and I wanted every calculator to live in one place instead of dozens of separate plugins. Here is the setup that worked for me.

The idea

One custom WordPress plugin holds everything. Each calculator is just an entry in a registry, plus a small JavaScript file with its logic. A single shortcode renders any calculator by its id:

[purecalc id="percentage"]
Enter fullscreen mode Exit fullscreen mode

That means a new calculator is a new registry entry and a new script, not a new plugin. Pages are built in Elementor, and the shortcode is dropped into each page.

Why one plugin

Separate plugins mean separate updates, separate settings screens and sometimes separate subscriptions. With one plugin I keep a single place for settings and a single place to fix bugs. The registry is also the one source of truth for the list of calculators, so category pages and sitemaps can be generated from it.

Keeping the math simple

Every calculator runs in the browser with plain JavaScript. There are no API calls, so results are instant and nothing about the visitor's numbers leaves the page. For anything finance related I test the formulas against known examples first. For example, a $300,000 loan at 6.5% over 30 years should give a monthly payment of about $1,896.

Making them embeddable

I also wanted other site owners to be able to use the calculators for free, so each one comes with an embed code. A blogger can paste it into a custom HTML block and the calculator shows up on their page. It is a cheap way to give a blog something useful, and it helps the calculators reach more people.

What I learned

  • Build the registry first. Everything else (shortcodes, hub pages, SEO data) becomes easy once the list of calculators is data.
  • Test formulas with known answers before publishing.
  • Keep each calculator self contained so one broken script never breaks the others.

You can try the calculators here: https://purecalculate.com

A few that people ask about most: the average calculator (https://purecalculate.com/average-calculator/), the steps to miles calculator (https://purecalculate.com/steps-to-miles-calculator/) and the working days calculator (https://purecalculate.com/working-days-calculator/).

If you have built something similar, I would love to hear how you structured it.

Top comments (0)