Skip to content

Instantly share code, notes, and snippets.

@digiltd
Forked from BFTrick/gettext-filter-multiple.php
Last active August 29, 2015 14:17
Show Gist options
  • Save digiltd/923ebdbce46dd3216f2c to your computer and use it in GitHub Desktop.
Save digiltd/923ebdbce46dd3216f2c to your computer and use it in GitHub Desktop.

Revisions

  1. @BFTrick BFTrick revised this gist Nov 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gettext-filter-multiple.php
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,4 @@ function my_text_strings( $translated_text, $text, $domain ) {
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'my_text_strings' );
    add_filter( 'gettext', 'my_text_strings', 20, 3 );
  2. @BFTrick BFTrick revised this gist Oct 18, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gettext-filter-multiple.php
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,4 @@ function my_text_strings( $translated_text, $text, $domain ) {
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'my_text_strings', 20, 3 );
    add_filter( 'gettext', 'my_text_strings' );
  3. @BFTrick BFTrick created this gist Oct 18, 2013.
    21 changes: 21 additions & 0 deletions gettext-filter-multiple.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    <?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 'Sale!' :
    $translated_text = __( 'Clearance!', 'woocommerce' );
    break;
    case 'Add to cart' :
    $translated_text = __( 'Add to basket', 'woocommerce' );
    break;
    case 'Related Products' :
    $translated_text = __( 'Check out these related products', 'woocommerce' );
    break;
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'my_text_strings', 20, 3 );