Skip to content

Instantly share code, notes, and snippets.

View crumina's full-sized avatar
🎯
Focusing

crumina

🎯
Focusing
View GitHub Profile
@BFTrick
BFTrick / gettext-filter.php
Last active August 18, 2022 18:53
Use the gettext WordPress filter to change any translatable string.
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Related Products' :
$translated_text = __( 'Check out these related products', 'woocommerce' );
@glueckpress
glueckpress / wcl10n-example.php
Last active December 14, 2015 21:31
[WordPress] Exclude text domains from language files by wrapping them into custom functions instead of default l10n functions. (http://glck.be/6651/)
<?php
/* String from your theme/plugin */
_e( 'Margaritas!', 'your-textdomain' );
__( 'Margaritas!', 'your-textdomain' );
/* Original string from WooCommerce: */
_e( 'Product', 'woocommerce' );
__( 'Product', 'woocommerce' );