1. Home
  2. Knowledge Base
  3. Tasty Recipes
  4. Customizing Tasty Recipes
  5. Filter: Add Potassium to the Nutrition section

Filter: Add Potassium to the Nutrition section

If you're interested in including Potassium in the Nutrition section of your recipe card, you can use this filter to add it in! Just add in the following snippet to your theme's functions.php file:

***Before doing this, make sure that you have access to your site's files via FTP (the editor in WordPress is not sufficient in case problems arise) and that you are comfortable with editing your functions.php file. Any minor error in the functions.php file can result in the “white screen of death,” which is easily fixed via FTP but is difficult to fix otherwise (and a nuisance as your site will be unavailable until fixed).***

/**
 * Add 'Potassium' as a Tasty Recipes attribute.
 *
 * @param array $attributes Existing nutrition attributes.
 * @return array
 */
add_filter(
	'tasty_recipes_nutrition_attributes',
	function( $attributes ) {
		$attributes['potassium'] = array(
			'label'        => 'Potassium',
			'nutrifox_key' => 'K',
		);
		return $attributes;
	}
);
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support