Skip to content

Nutrition

Armand Tresova edited this page Aug 28, 2024 · 5 revisions

Percent Daily Value Calculations

Each nutritional item (Fat, Saturated Fat, etc.) has its own unique daily value calculation. This value is set to American standards by default, but this number varies in different parts of the world. You can customize these values with some simple filters.

All Available Filters:

  • Total Fat
    cooked_pdv_fat
    Default: 78

  • Saturated Fat
    cooked_pdv_satfat
    Default: 20

  • Cholesterol
    cooked_pdv_cholesterol
    Default: 300

  • Sodium
    cooked_pdv_sodium
    Default: 2300

  • Total Carbohydrates
    cooked_pdv_carbs
    Default: 275

  • Fiber
    cooked_pdv_fiber
    Default: 28

  • Vitamin A
    cooked_pdv_vitamin_a
    Default: 900

  • Vitamin C
    cooked_pdv_vitamin_c
    Default: 90

  • Calcium
    cooked_pdv_calcium
    Default: 1300

  • Iron
    cooked_pdv_iron
    Default: 18

  • Potassium
    cooked_pdv_potassium
    Default: 4700

  • Vitamin D
    cooked_pdv_vitamin_d
    Default: 20

  • Vitamin E
    cooked_pdv_vitamin_e
    Default: 15

  • Vitamin K
    cooked_pdv_vitamin_k
    Default: 120

  • Thiamin
    cooked_pdv_thiamin
    Default: 1.2

  • Riboflavin
    cooked_pdv_riboflavin
    Default: 1.3

  • Niacin
    cooked_pdv_niacin
    Default: 16

  • Vitamin B6
    cooked_pdv_vitamin_b6
    Default: 1.7

  • Folate
    cooked_pdv_folate
    Default: 400

  • Vitamin B12
    cooked_pdv_vitamin_b12
    Default: 2.4

  • Biotin
    cooked_pdv_biotin
    Default: 30

  • Pantothenic Acid
    cooked_pdv_pantothenic_acid
    Default: 5

  • Phosphorus
    cooked_pdv_phosphorus
    Default: 1250

  • Iodine
    cooked_pdv_iodine
    Default: 150

  • Magnesium
    cooked_pdv_magnesium
    Default: 420

  • Zinc
    cooked_pdv_zinc
    Default: 11

  • Selenium
    cooked_pdv_selenium
    Default: 55

  • Copper
    cooked_pdv_copper
    Default: 0.9

  • Manganese
    cooked_pdv_manganese
    Default: 2.3

  • Chromium
    cooked_pdv_chromium
    Default: 35

  • Molybdenum
    cooked_pdv_molybdenum
    Default: 45

  • Chloride
    cooked_pdv_chloride
    Default: 2300

Example — Custom Plugin with Adjustments

<?php

/*
Plugin Name: Cooked Nutrition Customizations
Description: This plugin customizes some of the nutrition calculations.
Version: 1.0.0
Author: Boxy Studio
*/

// Protein Customization (90g)
add_filter( 'cooked_pdv_potassium', 'custom_cooked_pdv_potassium', 10, 1 );
function custom_cooked_pdv_potassium( $value ){ return 4500; }

// Carbs Customization (20g)
add_filter( 'cooked_pdv_carbs', 'custom_cooked_pdv_carbs', 10, 1 );
function custom_cooked_pdv_carbs( $value ){ return 20; }

// Fat Customization (173g)
add_filter( 'cooked_pdv_fat', 'custom_cooked_pdv_fat', 10, 1 );
function custom_cooked_pdv_fat( $value ){ return 173; }

?>