Back to Support Content and Media Recipes Shortcode

Recipes Shortcode

On WordPress.com, you can use shortcodes to embed a recipe with consistent formatting, basic metadata, and an option to print. You’ll find an example at the bottom of this guide!

Embedding a Recipe

To add a recipe to your site, use the recipe shortcode. You can add a shortcode to any page or post using a Shortcode block.

Everything between the opening [recipe] and closing [/recipe] tags will be set apart as the recipe on your page.

Example Code (Note: Remove spaces at the beginning of each line if your code is not working.):

[recipe title="" 
  servings="" 
  preptime="" 
  cooktime="" 
  difficulty="" 
  rating="" 
  image="" 
  description=""]
[recipe-notes]
  Enter your recipe notes here.
[/recipe-notes]
[recipe-ingredients]
  * Ingredient
  * Ingredient
  * Ingredient
[/recipe-ingredients]
[recipe-directions]
  1. Direction
  2. Direction
  3. Direction
[/recipe-directions]
[recipe-nutrition]
  Per Serving: 580 calories; 33 g fat; 50.6 g carbohydrates;
  20.3 g protein; 50 mg cholesterol; 760 mg sodium.
[/recipe-nutrition]
[/recipe]

List of Attributes

You can include several optional ‘attributes’ to add extra information to your recipe. This also helps search engines properly index your recipe since the code uses special “microdata” for recipes.

You’ll see each of these attributes in action in the example at the end of this guide.

Adding Notes, Ingredients, Directions, and More

Since many recipes follow similar formats, we’ve included some extra formatting for these elements.

To add notes, use the recipe-notes shortcode:

[recipe-notes]
Add your notes, tips, etc here.
[/recipe-notes]

To add ingredients, use the recipe-ingredients shortcode:

[recipe-ingredients]
Add ingredients here.
[/recipe-ingredients]

To add directions, use the recipe-directions shortcode:

[recipe-directions]
Add directions here.
[/recipe-directions]

To add nutrition information, use the recipe-nutrition shortcode:

[recipe-nutrition]
Add nutrition information here.
[/recipe-nutrition]

To add an image to the recipe, use the recipe-image shortcode:

[recipe-image
image=”IMAGE URL”]

NOTE: when you use the recipe-image shortcode if you had used the image attribute in the general recipe shortcode above, then that image will not be displayed anymore.

Each of the above shortcodes should be placed inside the [recipe]...[/recipe] shortcode and can be used in any order, any number of times—it’s up to you what you need!

Customizing the Section Titles

By default, a title is included for recipe-ingredients and recipe-directions. You can customize this.

To hide the title:
[recipe-directions title=false]

To change the title to something else:
[recipe-ingredients title="Topping Ingredients"]

Creating Lists

Since these elements often use lists, we’ve added some special formatting to make it really straightforward to make a list.

To create a bulleted list, follow this format:

- item one
- item two
- item three

To create a numbered list, follow this format:

1. item one
2. item two
3. item three

Example of a Complete Recipe

[recipe title="Summer Pasta with Basil, Tomatoes and Cheese" servings="4-6" preptime="20 mins" cooktime="10 mins" difficulty="easy" rating="★★★★★" image="https://en-support.files.wordpress.com/2014/01/food-dinner-pasta-broccoli.jpg" description="A fresh, light, Italian-inspired pasta recipe perfect for a late summer dinner."]

Put your recipe here. Tip: use ordered and unordered lists, headings, images, and links to improve the look of your recipe. You can also use special tags to format notes, ingredients, and directions.

[recipe-notes]
Credit: allrecipes.com
[/recipe-notes]

[recipe-ingredients]
- 2 pounds vine-ripened tomatoes
- 3 cloves garlic
- 1/2 cup chopped fresh basil
[/recipe-ingredients]

[recipe-directions]
1. In a medium bowl, toss together tomatoes, garlic, basil, mint, salt, and black pepper.
2. Cook and drain pasta.
3. Mix together.
[/recipe-directions]

[recipe-nutrition] Per Serving: 580 calories; 33 g fat; 50.6 g carbohydrates; 20.3 g protein; 50 mg cholesterol; 760 mg sodium. [/recipe-nutrition] 

[/recipe]

Recipe Shortcode in Action

  • Servings: 4-6
  • Difficulty: easy
  • Rating: ★★★★★
  • Print

A fresh, light, Italian-inspired pasta recipe perfect for a late summer dinner.

Ingredients

  • 2 pounds vine-ripened tomatoes, seeded and diced
  • 3 cloves garlic, minced
  • 1/2 cup chopped fresh basil
  • 1 tablespoon chopped fresh mint leaves
  • 3/4 teaspoon salt
  • 1/2 teaspoon freshly ground black pepper
  • 1/4 teaspoon crushed red pepper flakes
  • 1/2 cup olive oil
  • 1/4 cup cream sherry
  • 12 ounces spaghetti
  • 1/2 cup freshly grated Asiago cheese
  • 2 cups fontina cheese, shredded

Directions

  1. In a medium bowl, toss together tomatoes, garlic, basil, mint, salt and black pepper, hot pepper flakes, olive oil, and cream sherry. Let stand at room temperature for up to 2 hours, stirring occasionally.
  2. Cook the pasta In a large pot of boiling salted water until tender, but firm to the bite.
  3. Drain the pasta, and transfer to a large serving bowl. Drain 1/4 cup of the liquid from the tomato mixture, and toss with the pasta to coat. Add cheese, and toss until it begins to melt. Add the tomato mixture, and toss until mixed.

Nutrition

Per Serving: 580 calories; 33 g fat; 50.6 g carbohydrates; 20.3 g protein; 50 mg cholesterol; 760 mg sodium.

Was this guide helpful for you?

Not quite what you're looking for? Get Help!

Copied to clipboard!