Created by
Dmitry Merkulov
| /**
* Modify the JSON-LD output for the Recipe schema type
* @package Stellar
*/
add_filter( 'stellar_structured_data', function ( $json_ld ) {
// Get receipt properties
$prep_time = get_post_meta( get_the_ID(), 'prep_time', true );
$cook_time = get_post_meta( get_the_ID(), 'cook_time', true );
// Replace placeholders with actual values
$json_ld = str_replace( '[prepTime]', esc_attr( $prep_time ), $json_ld );
$json_ld = str_replace( '[cookTime]', esc_attr( $cook_time ), $json_ld );
// Return modified JSON-LD
return $json_ld;
} );
|