Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/35659d8bbf33766f5ee09b5ee40c78e1 to your computer and use it in GitHub Desktop.
Save danielbachhuber/35659d8bbf33766f5ee09b5ee40c78e1 to your computer and use it in GitHub Desktop.
<?php
/**
* Filters the output of the Tasty Recipes block.
*
* @param string $output Existing output.
* @param array $block Block data.
* @return string
*/
add_filter( 'render_block', function( $output, $block ){
// Only modify the Tasty Recipes block.
if ( 'wp-tasty/tasty-recipe' !== $block['blockName'] ) {
return $output;
}
// Replace the given keys with the given values.
$search_replace = array(
'Ingredients' => 'Zutaten',
'Instructions' => 'Anleitung',
'Category:' => 'Kategorie:',
);
return str_replace( array_keys( $search_replace ), array_values( $search_replace), $output );
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment