Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Brecht

    (@brechtvds)

    To manipulate the output of the recipe metadata you can add something like this to your theme’s functions.php file:

    function wprm_recipe_metadata( $metadata ) {
    	$metadata['isPartOf'] = array( '@id' => '#abc' );
    
    	return $metadata;
    }
    add_filter( 'wprm_recipe_metadata', 'wprm_recipe_metadata' );

    Hope that helps!

    Thread Starter Contemplating Sweets

    (@contemplatingsweets)

    This is helpful. I think I need to pull the page url of the current post and add to add before that before #abc in the id. What is the best way to do that? Thanks.

    Thread Starter Contemplating Sweets

    (@contemplatingsweets)

    I also need to add the id for the recipe itself so there is something to reference.

    @id https://www.contemplatingsweets.com/recipe-post-slug/#recipe

    isPartOf
    @id https://www.contemplatingsweets.com/recipe-post-slug/#article

    I think if I can get those added I have the rest in place.

    Plugin Author Brecht

    (@brechtvds)

    Something like this might work:

    function wprm_recipe_metadata( $metadata ) {
    	global $wp;
    	$url = home_url( $wp->request );
    
    	$metadata['@id'] = $url . '#recipe';
    	$metadata['isPartOf'] = array( '@id' => $url . '#article' );
    
    	return $metadata;
    }
    add_filter( 'wprm_recipe_metadata', 'wprm_recipe_metadata' );
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘adding isPartOf https://www.myurl.com/#article to schema’ is closed to new replies.