Pregnancy Due Date Calculator
Pregnancy due-date calculator with LMP, conception-date and IVF transfer-date methods. Shortcode-only — no header / footer markup, no external CDN dependencies (icons are inline SVG). Use [pregnancy_calculator] in any page or post.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/cjbodullo/pregnancy-calculator-plugin/archive/refs/heads/master.zipWordPress shortcode that renders a pregnancy due-date calculator mirroring the standalone nameGeneratorTool pregnancy calculator. Drops cleanly into any page or post — no header / footer markup, no external CDN, no jQuery.
Text domain: pregnancy-calculator-plugin
Version: 1.0.0 (PCP_VERSION in the main plugin file).
Requirements
- WordPress 5.x or newer.
- PHP 7.4+.
Installation
- Copy the
pregnancy-calculator-pluginfolder intowp-content/plugins/. - In Plugins, activate Pregnancy Due Date Calculator.
- Add the shortcode
[pregnancy_calculator]to any page or post.
That's it — no settings page, no database tables, no API keys.
Shortcode
[pregnancy_calculator]
Attributes (all optional)
| Attribute | Default | Purpose |
|---|---|---|
title |
Discover Your Expected Due Date |
Hero headline (only shown if show_hero="yes"). |
subtitle |
Lead paragraph from the standalone tool | Hero sub-paragraph. |
show_hero |
yes |
Toggle the hero section + 280 / 40 / 3 stat trio. |
show_info |
yes |
Toggle the "How Our Calculator Works" cards (LMP / Conception / IVF explainers). |
show_milestones |
yes |
Toggle the milestones grid (Week 4-6 → Week 37-40). |
show_tips |
yes |
Toggle the prenatal-care tips grid. |
show_trimesters |
yes |
Toggle the trimester guide cards. |
max_width |
1200px |
Page max-width (px, %, rem, em, vw). |
yes / no are case-insensitive; 1, true, on, y also count as truthy; everything else is treated as no.
Examples
Full page (default):
[pregnancy_calculator]
Just the calculator, no surrounding sections (great for sidebars or product pages):
[pregnancy_calculator show_hero="no" show_info="no" show_milestones="no" show_tips="no" show_trimesters="no"]
Calculator + milestones only, custom hero copy:
[pregnancy_calculator
title="Your Personalized Pregnancy Timeline"
subtitle="Pick a method below and we'll do the math."
show_info="no"
show_tips="no"
show_trimesters="no"]
Narrower full layout:
[pregnancy_calculator max_width="960px"]
What you get
- Three calculation methods: LMP, Conception Date, IVF Transfer (Day 3 or Day 5 blastocyst).
- Date inputs are capped at today so a visitor can't pick a future date.
- Results card with due date, countdown ("X days to go" / "Y days overdue" / "Due today!"), current week + day, trimester, days remaining, conception date, and a 0–40 week progress bar.
- All form state lives inside the shortcode's own DOM tree, so you can drop multiple instances on the same page and they'll behave independently.
- Inline-SVG icons — no FontAwesome, no Google Fonts, no external requests.
Architecture
| Piece | Path |
|---|---|
| Plugin entry | pregnancy-calculator-plugin.php |
| Shortcode markup | pcp_render_shortcode() |
| Date math + UI behaviour | assets/js/pregnancy-calculator.js |
| Styles | assets/css/pregnancy-calculator.css (every selector scoped under .pcp-shell) |
| Icons | pcp_icon() (inline SVG) |
The CSS uses CSS custom properties on .pcp-shell, so you can repaint the whole tool from your theme without touching the plugin:
.pcp-shell {
--pcp-teal-deep: #0b4f4f;
--pcp-teal: #38b2ac;
--pcp-coral: #ff8a8a;
--pcp-coral-dark: #f06262;
}
Calculation rules
The same rules as the original nameGeneratorTool calculator:
- LMP:
due = LMP + 280 + (cycle - 28)days;conception = LMP + round(cycle / 2). - Conception Date:
due = conception + 266;LMP = conception − 14. - IVF Day 3:
due = transfer + 263;conception = transfer − 3;LMP = conception − 14. - IVF Day 5 (blastocyst):
due = transfer + 261;conception = transfer − 5;LMP = conception − 14.
This is for estimation only — the in-tool banner makes that explicit.