Skip to content

Instantly share code, notes, and snippets.

@carstingaxion
Last active May 16, 2024 16:05
Show Gist options
  • Save carstingaxion/9ab2f5e342706068a70519701c8f43d5 to your computer and use it in GitHub Desktop.
Save carstingaxion/9ab2f5e342706068a70519701c8f43d5 to your computer and use it in GitHub Desktop.
gettext_domain filter example to prepare twentysixteen theme for more inclusive language
<?php
add_filter( 'gettext_twentysixteen', 'make_twentysixteen_author_more_inclusive', 10, 3 );
/**
* Code snippet to make the "Author:" text in the Twentysixteen theme more inclusive
*
* @link https://developer.wordpress.org/reference/hooks/gettext_domain/
* @link https://github.com/WordPress/twentysixteen/blob/master/template-parts/biography.php#L28
*/
function make_twentysixteen_author_more_inclusive( $translated_text, $text, $domain ) {
switch ( $text ) {
case 'Author:':
$translated_text = 'Autorin:';
break;
// Add more cases for other strings you want to change
}
return $translated_text;
}
@carstingaxion
Copy link
Author

My attempt to answer a question in the fediverse
https://dewp.space/@sofasophia@fairmove.net/112451466822221844

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment