Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jesseeproductions/f4252037707ca825cad5bb0c47d47e24 to your computer and use it in GitHub Desktop.
Save jesseeproductions/f4252037707ca825cad5bb0c47d47e24 to your computer and use it in GitHub Desktop.
Change Categories to Location for Coupon Creator Pro Filter Bar
/**
* Change Categories to Location for Coupon Creator Pro Filter Bar
*
* @param string $translation The translated text.
* @param string $text The text to translate.
* @param string $domain The domain slug of the translated text.
* @param string $context The option context string.
*
* @return string The translated text or the custom text.
*/
add_filter( 'gettext', 'cctor_change_category_to_location', 20, 3 );
function cctor_change_category_to_location( $translation, $text, $domain, $context = "" ) {
if (
$domain != "default" &&
(
strpos( $domain, 'coupon-creator' ) !== 0
)
) {
return $translation;
}
$custom_text = array(
'Categories:' => 'Location:',
);
// If we don't have replacement text, bail.
if ( empty( $custom_text[ $text ] ) ) {
return $translation;
}
return $custom_text[ $text ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment