Gravity Forms template

Cooking measurement converter template

Volume, weight and cups-to-grams conversions for twelve common ingredients, with a three-way switch. Eight inputs, four calculation fields shown by conditional logic, no submit.

Try the live Cooking measurement converter first
Template $9
  • Import-ready Gravity Forms JSON
  • One-page install guide
  • The plugins it needs, with links
Buy the template

What you'll need

Check these before you buy so there are no surprises. Links may be affiliate links.

Free build guide: Cooking measurement converter for WordPress

This guide rebuilds the Cooking measurement converter from this site in Gravity Forms: 8 inputs, 4 live results and no submit button. Expect about 36 minutes by hand. The template above is the same form as an import file, and the bundle adds a PDF version of this guide with a screenshot of every setting, plus the stylesheet.

You will end up with:

  • Result
  • Result
  • Grams
  • Ounces

What you need

Everything here is core Gravity Forms. No add-ons.

1. Create the form

  1. Go to Forms → New Form and name it Cooking measurements.
  2. In Form Settings → Form Layout, set the CSS Class Name to fo-live-only. Step 3 uses it to hide the submit button.
  3. Leave the form open in the editor; the fields come next.

2. Add the fields, in this order

Field IDs are assigned as you add fields. If yours come out differently, change the {Label:ID} references in the formulas to match your IDs. Settings not mentioned stay at their defaults.

1. Convert · Radio Buttons · ID 1
Custom CSS Class (Appearance tab) fo-segmented.

Choices (tick show values and enter each value):

  • Volume — value volume (selected by default)
  • Weight — value weight
  • Cups to grams — value ingredient

2. Amount · Number · ID 2
Number Format 9,999.99; Default Value 1.

3. From · Drop Down · ID 3
Layout: half width, on the same row as its neighbour (drag the field beside it in the editor; no CSS class needed); Conditional Logic (Advanced tab): Show this field if Convert is Volume..

Choices (tick show values and enter each value):

  • teaspoon — value 4.929
  • tablespoon — value 14.787
  • fluid ounce — value 29.574
  • cup (US) — value 236.588 (selected by default)
  • pint (US) — value 473.176
  • quart (US) — value 946.353
  • millilitre — value 1
  • litre — value 1000

4. To · Drop Down · ID 4
Layout: half width, on the same row as its neighbour (drag the field beside it in the editor; no CSS class needed); Conditional Logic (Advanced tab): Show this field if Convert is Volume..

Choices (tick show values and enter each value):

  • teaspoon — value 4.929
  • tablespoon — value 14.787 (selected by default)
  • fluid ounce — value 29.574
  • cup (US) — value 236.588
  • pint (US) — value 473.176
  • quart (US) — value 946.353
  • millilitre — value 1
  • litre — value 1000

5. From · Drop Down · ID 5
Layout: half width, on the same row as its neighbour (drag the field beside it in the editor; no CSS class needed); Conditional Logic (Advanced tab): Show this field if Convert is Weight..

Choices (tick show values and enter each value):

  • ounce — value 28.3495 (selected by default)
  • pound — value 453.592
  • gram — value 1
  • kilogram — value 1000

6. To · Drop Down · ID 6
Layout: half width, on the same row as its neighbour (drag the field beside it in the editor; no CSS class needed); Conditional Logic (Advanced tab): Show this field if Convert is Weight..

Choices (tick show values and enter each value):

  • ounce — value 28.3495
  • pound — value 453.592
  • gram — value 1 (selected by default)
  • kilogram — value 1000

7. Ingredient · Drop Down · ID 7
Layout: half width, on the same row as its neighbour (drag the field beside it in the editor; no CSS class needed); Conditional Logic (Advanced tab): Show this field if Convert is Cups to grams..

Choices (tick show values and enter each value):

  • All-purpose flour (125 g per cup) — value 125 (selected by default)
  • Granulated sugar (200 g) — value 200
  • Brown sugar, packed (220 g) — value 220
  • Powdered sugar (120 g) — value 120
  • Butter (227 g) — value 227
  • Honey or syrup (340 g) — value 340
  • Rolled oats (90 g) — value 90
  • Uncooked rice (185 g) — value 185
  • Cocoa powder (100 g) — value 100
  • Milk (240 g) — value 240
  • Water (237 g) — value 237
  • Vegetable oil (218 g) — value 218

8. Measured in · Drop Down · ID 8
Layout: half width, on the same row as its neighbour (drag the field beside it in the editor; no CSS class needed); Conditional Logic (Advanced tab): Show this field if Convert is Cups to grams..

Choices (tick show values and enter each value):

  • cups — value 236.588 (selected by default)
  • tablespoons — value 14.787
  • teaspoons — value 4.929
  • millilitres — value 1

9. Result · Number · ID 9
Number Format 9,999.99; Description “In the "To" unit.”; Custom CSS Class (Appearance tab) fo-result; tick Enable Calculation, Rounding 2; Conditional Logic (Advanced tab): Show this field if Convert is Volume..

{Amount:2} * {From vol:3} / {To vol:4}

10. Result · Number · ID 10
Number Format 9,999.99; Description “In the "To" unit.”; Custom CSS Class (Appearance tab) fo-result; tick Enable Calculation, Rounding 2; Conditional Logic (Advanced tab): Show this field if Convert is Weight..

{Amount:2} * {From wt:5} / {To wt:6}

11. Grams · Number · ID 11
Number Format 9,999.99; Description “Spooned and levelled, not packed, unless the ingredient says so.”; Custom CSS Class (Appearance tab) fo-result; tick Enable Calculation, Rounding 0; Conditional Logic (Advanced tab): Show this field if Convert is Cups to grams..

{Amount:2} * {Unit:8} / 236.588 * {Ingredient:7}

12. Ounces · Number · ID 12
Number Format 9,999.99; Custom CSS Class (Appearance tab) fo-result fo-result--sub; tick Enable Calculation, Rounding 2; Conditional Logic (Advanced tab): Show this field if Convert is Cups to grams..

{Amount:2} * {Unit:8} / 236.588 * {Ingredient:7} / 28.3495

3. Hide the submit button

The results are live, so nothing needs submitting. Add this filter to your theme’s functions.php or a code-snippets plugin; it hides the button on any form carrying the fo-live-only class:

add_filter( 'gform_submit_button', function ( $button, $form ) {
	return str_contains( (string) rgar( $form, 'cssClass' ), 'fo-live-only' ) ? '' : $button;
}, 10, 2 );

Or with CSS alone: .fo-live-only_wrapper .gform_footer { display: none; }

4. Put it on a page and make it look like this

Add the form to any page with the Gravity Forms block, or the shortcode [gravityform id="X" title="false" ajax="false"]. The form inherits your theme’s styles; the classes you set in step 2 are hooks for the look you see on this site:

  • fo-result on a calculation field makes it the big teal result panel.
  • fo-result fo-result--sub makes the smaller secondary figures.
  • fo-segmented on a radio field turns it into a segmented switch.
  • Two fields on one row is the editor’s own column layout: drag a field beside another and the row splits in half. No CSS class is needed, and the old gf_left_half Ready Classes are deprecated.

The bundle includes the two stylesheets that implement those classes, with notes on matching your brand colours. Without them the form still works; it just looks like your theme’s default Gravity Forms styling.

How the maths works is explained under “How it’s calculated” on the live Cooking measurement converter.