Created
May 28, 2019 21:18
-
-
Save danielbachhuber/35659d8bbf33766f5ee09b5ee40c78e1 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* 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