# BMI Calculator Widget for WordPress

Check your health with our free BMI Calculator. Instantly calculate your Body Mass Index for adults and children using official WHO and CDC guidelines.

**What you enter:** Gender, Age, Height, Weight.

**What you get:** Body Mass Index (BMI).

![BMI Calculator Input Form](/assets/images/screenshot-1.png "BMI Calculator Input Form")
![BMI Calculator Calculation Results](/assets/images/screenshot-2.png "BMI Calculator Calculation Results")

## Installation

1. [Download](https://github.com/pub-calculator-io/bmi-calculator/archive/refs/heads/master.zip) the ZIP file of this repository.
2. Upload the /bmi-calculator-master/ folder to the /wp-content/plugins/ directory.
3. Activate the [BMI Calculator](https://www.calculator.io/bmi-calculator/ "BMI Calculator Homepage") plugin through the "Plugins" menu in WordPress.

## Usage
* Add the shortcode `[ci_bmi_calculator]` to your page, post or sidebar.
* Or add the following code: `<?php echo do_shortcode( '[ci_bmi_calculator]' ); ?>` to your template where you would like the BMI Calculator to appear.

### Attributes

All attributes are optional; invalid values are ignored and the default is used.

| Attribute | Values | Default | Description |
| --- | --- | --- | --- |
| `title` | `1` or `0` | `1` | Show or hide the heading with the calculator's icon. |
| `theme` | `light`, `dark`, `auto` | `light` | `auto` follows the visitor's light/dark system setting. |
| `accent` | hex colour, e.g. `#2563eb` | calculator.io orange | Accent colour of buttons and highlights. |
| `max_width` | number + `px`, `%` or `rem`, e.g. `720px` | none | Maximum width; the calculator is centred when narrower than its column. |

Example: `[ci_bmi_calculator title="0" theme="auto" accent="#2563eb" max_width="720px"]`

## FAQ

**Does it send data anywhere?** No. The calculation runs in the visitor's browser; the plugin makes no external requests, sets no cookies and loads no ads or trackers.

**How do I get a dark calculator?** Use `theme="dark"`, or `theme="auto"` to follow the visitor's system setting.

**How do I hide the heading?** Use `title="0"`.

## Source code and libraries

The plugin's own JavaScript and CSS are shipped unminified and human-readable: `assets/js/*.js` (except `assets/js/lib/`), `assets/css/main.css`, `assets/css/ci-widget.css` and `assets/css/ci-embed.css`. `main.css` is the compiled, unminified stylesheet of calculator.io.

Third-party libraries bundled in `assets/js/lib/` (minified builds have their readable source upstream):

* [math.js](https://github.com/josdejong/mathjs) 3.37.1 - Apache-2.0 - `assets/js/lib/math.min.js`, minified build
* [marked](https://github.com/markedjs/marked) 15.0.12 - MIT - `assets/js/lib/marked.min.js`, minified build
* [Inputmask](https://github.com/RobinHerbots/Inputmask) 5.0.9-beta.70 - MIT - `assets/js/lib/input-mask.min.js`, minified build
* [lazysizes](https://github.com/aFarkas/lazysizes) 5.3.2 - MIT - `assets/js/lib/lazysizes.js`
* [Air Datepicker](https://github.com/t1m0n/air-datepicker) 3.3.0 - MIT - `assets/js/lib/air-datepicker.js`
* [Inter font](https://github.com/rsms/inter) - SIL Open Font License 1.1 - `assets/fonts/inter-v20-latin.woff2`
