Skip to content

Instantly share code, notes, and snippets.

@graylaurenm
Created March 29, 2022 00:02
Show Gist options
  • Save graylaurenm/a5cdcd23917f9ae1e85dcaeb487f8c5c to your computer and use it in GitHub Desktop.
Save graylaurenm/a5cdcd23917f9ae1e85dcaeb487f8c5c to your computer and use it in GitHub Desktop.
<?php
add_filter( 'tasty_recipes_recipe_template_vars', __NAMESPACE__ . '\replace_tasty_image_size', 10, 2 );
function replace_tasty_image_size( $template_vars, $recipe ) {
$recipe_json = $recipe->to_json();
$template_vars['recipe_image'] = ! empty( $recipe_json['image_sizes']['placement-recipe'] ) ? $recipe_json['image_sizes']['placement-recipe']['html'] : '';
return $template_vars;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment