How to add a pregnancy calculator to your WordPress site

Blog

8 min read

To add a pregnancy (due date) calculator to WordPress, you install a calculator plugin, create a calculator in wp-admin and place it on a page with a shortcode or a block. With WP Pregnancy & Ovulation Calculator PRO that means three stops: the Plugins screen, the calculator’s settings and the page editor. This guide goes through them in order, with the setting names you will see on screen, and ends with checks to run before you share the page.

Free or Pro: which version should you install?

There are two versions of our pregnancy calculator plugin for WordPress. The free WP Pregnancy & Ovulation Calculator comes from the WordPress.org directory. It has one calculator for the whole site, set up under Pregnancy & Ovulation in wp-admin and placed with the shortcode [ultimate-pregnancy-ovulation]. It offers the ovulation calculator and two pregnancy methods, Due Date and Last Period, and it has no form, email results, PDF or entries.

Pro adds the Conception, Ultrasound and IVF Transfer methods, any number of calculators, a lead form, results by email, a PDF download, an entries screen and five integrations. The rest of this guide covers Pro. If you are still deciding, the free vs Pro comparison lists every difference.

How do you install Pro and activate the license?

  1. Choose a plan (see the plans) and download the plugin’s zip file after checkout.
  2. In wp-admin, open Plugins, click the button to add a new plugin, then Upload Plugin. Choose the zip file, click Install Now, then Activate Plugin. WordPress.org’s guide to managing plugins shows these screens.
  3. If the free version is active, you don’t need to remove it first: activating Pro deactivates the free plugin automatically.
  4. Go to Pregnancy & Ovulation Pro → Settings → License, paste your license key and click Activate.

The license key matters for more than updates. While it is active, updates arrive in the Plugins screen with one click, and the Entries screen, CSV export and the integrations work. If it lapses, the calculator, emails and PDFs keep working, those features stop, and a notice in wp-admin lists what is missing.

Two notes for whoever runs your hosting. Pro creates two database tables the first time you open a wp-admin page after installing it, so the database user needs CREATE and ALTER permissions. And some libraries bundled with Pro declare PHP 8.1 as their minimum, so run the site on PHP 8.1 or newer.

How do you create the calculator?

Go to Pregnancy & Ovulation Pro → Add New Calculator and type a name in the Calculator Name field in the sidebar; it is how you will recognize the calculator in the list of calculators and in the entries. The settings sit in a Calculator Settings box with six tabs: Settings, Calculation, Styling, Integrations, Labels Customization and Email/PDF templates. For a first calculator, start with Calculation and Settings.

Choose the type and the default method

On the Calculation tab, set Calculator Type to Pregnancy Calculator. Then choose, under Calculator Method, the method the calculator opens with. Visitors can switch between all five methods in a Calculation Method drop-down, and there is no setting to hide one:

  • Due Date: the visitor already has a due date and wants to see how far along the pregnancy is.
  • Last Period: the first day of the last period and the average cycle length (20 to 42 days, 28 by default). This is the default method.
  • Conception: the date of conception.
  • Ultrasound: the scan date and the length of pregnancy measured at the scan, in weeks and days.
  • IVF Transfer: the transfer date and whether it was a Day 3 or a Day 5 embryo.

Last Period suits most general audiences. ACOG notes that a due date is calculated from the first day of the last period, and that for an IVF pregnancy it is set by the embryo’s age and the transfer date (ACOG: How Your Fetus Grows During Pregnancy). A practice that dates pregnancies by scan, or a fertility clinic, may prefer Ultrasound or IVF Transfer as the default; the NHS notes that the dating scan can more accurately estimate how many weeks pregnant someone is. The same tab holds Date Format and Week Start.

How do you choose how visitors get their results?

On the Settings tab, Result type decides when the result appears:

  • Independent Result (the default): “The result will be displayed on the page without the need to submit the form.”
  • After Form Submission: the result stays hidden until the visitor fills in the form and clicks Show Result.

Under User Form settings, “Enable user form” adds the form and its Send to Email button. If you switch the form off, the calculator goes back to Independent Result. The default fields are Firstname, Lastname and Email, all required; Phone and Message are available too. You can turn each field on or off, make it required and drag the fields into a different order. “Show PDF download button” (on by default) adds Download PDF.

Two more settings are worth a look before you publish. “Enable admin notification” (on by default) emails you each time someone submits the form, at the site admin address unless you enter another; it lists the contact details, not the results. “Show User agreements” (off by default) adds a checkbox the visitor must tick, with links to your privacy policy and terms.

Each entry pairs a person’s contact details with the fact that they used a pregnancy or ovulation calculator, so treat it as health-related data: ask only for what you need, and say why you ask. You are responsible for consent and for your privacy policy, and this guide is not legal advice; see privacy and GDPR for a pregnancy calculator. To choose between the delivery options, read how to use a pregnancy calculator for lead generation.

How do you add the calculator to a page or post?

Click Save. The sidebar now shows Your Shortcode with a copy button. It looks like [upo-calc-pro id="123"], with your calculator’s own ID. Then place the calculator where you want it:

  • Block editor: add the block called Ultimate Pregnancy & Ovulation Calculator Pro (in the Widgets category) and pick your calculator in the block settings sidebar; the editor shows a preview. Pasting the shortcode into a Shortcode block works too.
  • Classic editor: paste the shortcode where the calculator should appear.
  • Sidebars and footers: put the shortcode in a widget area, for example in a Shortcode block.
  • Page builders: use the builder’s own shortcode element. The plugin has no page builder widget of its own.

Plan around two rules. Only one calculator works on a page, because the plugin’s script reads the first calculator it finds, so give a pregnancy calculator and an ovulation calculator separate pages. And one calculator can appear on as many pages as you like, so you don’t need a copy for each page.

How do you test the calculator before you share the page?

If WordPress shows an update for Pro, install it first: version 1.1.5 corrected how gestational age, due dates, conception dates and trimesters are calculated. Then:

  1. Open the page in a private browser window. Logged-in administrators see an Edit Calculator link under the calculator; your visitors don’t.
  2. With Independent Result, a result should show straight away, because the date fields start pre-filled (14 days before today, or today for the Due Date method). A pregnancy result shows the baby-size card, days until birth, the trimester timeline and the dates, and it updates as soon as an input changes. Dates are picked from a calendar pop-up rather than typed.
  3. Check one date you can work out by hand. With Last Period and a 28-day cycle, the due date should fall 280 days (40 weeks) after the date you entered: by convention, ACOG puts the due date 280 days after the first day of the last period, a rule that assumes a 28-day cycle. Change the cycle length to 32 days and the due date moves 4 days later, because the plugin shifts its estimate by the difference from 28 days. (The NHS due date calculator also asks for cycle length.)
  4. If the form is on, submit it once with your own email address. Check the results email (its default subject is Pregnancy & Ovulation Calculator Pro results), the admin notification, the PDF download and the new row under Pregnancy & Ovulation Pro → Entries.
  5. Read the result as a visitor would. The plugin prints “* the results of this calculator are estimations only” under the result, its default email says the dates are estimates and may vary and suggests contacting a healthcare provider, and the PDF footer calls the result approximate. Keep those notes, and add a sentence near the calculator in your own words: the result is an estimate, and it doesn’t replace a check-up or advice from a doctor or midwife.
  6. Open the page on a phone. The layout adapts to narrow screens; check that the date pop-up, the form and the buttons are easy to use there.

Where do you find the entries?

Form submissions appear under Pregnancy & Ovulation Pro → Entries, with the date, calculator, name, email, phone, message, calculator type and method. You can filter by date, choose columns in Screen Options, open a Details view and delete entries. Export CSV, in the same menu, downloads entries for a date range with the fields you pick. Both screens need an active license.

Entries are kept as plain text in your own WordPress database. They don’t include the dates the visitor entered or the results: those go only to the visitor, on screen, by email or in the PDF. Delete entries you no longer need. If you ever remove the plugin, the option “Delete all data when uninstalling the plugin” on the Settings page removes its data as well.

To see your visitors’ side of it, open the pregnancy calculator demo, then set up your own.

All posts