Yummy Docs

Nutrition facts

This plugin makes it easy to insert nutrition facts for recipes. Nutrition facts are also fully compliant with structured data, which means that search engines and other services may use the nutrition facts on their results.

Setting nutrition facts is optional. You have an option to hide nutrition facts from the recipe card and/or from the print template.

Localizing the daily values #

The percent daily values (%DV) for the nutrition facts table are calculated automatically from the inserted values. The daily value percentages are based on FDA's (U.S. Food & Drug Administration) recommendations.

Here are the default daily values:

Nutrient Daily value Unit
Fat 78 g
Saturated fat 20 g
Cholesterol 300 mg
Sodium 2300 mg
Total Carbohydrate 275 g
Dietary Fiber 28 g
Sugars 50 g
Protein 50 g

If the daily values for your country are different, you can use a filter called yummy_filter_nutrition_daily_value to change the daily values.

function my_custom_daily_values( $value, $name ) {
if ( $name === 'saturatedFatContent') {
$value = 40;
}

return $value;
}
add_filter( 'yummy_filter_nutrition_daily_value', 'my_custom_daily_values', 100, 2 );

Important! As always it is recommended to insert custom functions with a site specific plugin or with a plugin like Code Snippets. If you insert custom function directly into your theme files, they may be overridden on theme updates!