Created
March 6, 2019 18:16
-
-
Save danielbachhuber/dab1348dc33a7c8b6c81af6097313828 to your computer and use it in GitHub Desktop.
Use the post's featured image when the EasyRecipe doesn't have an image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use the post's featured image when the EasyRecipe doesn't have an image. | |
* | |
* @param integer $image_id Image ID to be used. | |
* @param object $recipe Tasty Recipe object. | |
* @param integer $post_id Original post ID. | |
*/ | |
add_filter( 'tasty_recipes_convert_easyrecipe_image_id', function( $image_id, $recipe, $post_id ) { | |
if ( $image_id ) { | |
return $image_id; | |
} | |
return get_post_thumbnail_id( $post_id ); | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment