• Resolved srw96601

    (@srw96601)


    I really need to be able to change the text on forms and in other places – I read through the way to change a few things but its nowhere near enough- is there a place that tells you all the codes to change things like “Donation ID:”, not just on the form but also in email confirmations… been pulling my hair out trying to figure it out based on your instructions to change “Offline Donation” to something else, but I have no idea how to hook into anything else.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hi there,

    To really do that reliably you should be comfortable and familiar with PHP code and how to scan plugins for their hooks and filters as well as what GETTEXT is.

    Nevertheless, another route that might be quite a bit easier is this snippet:
    https://github.com/WordImpress/Give-Snippet-Library/blob/master/translation-snippets/change-text.php

    Basically, make sure the $domain == 'give' is there, then change the $translation string to the one you want to change and provide the translation. Then do it again for the next string, and the next.

    I’d HIGHLY recommend doing this in a local environment (not LIVE), and to add these snippets into a custom functionality plugin. Otherwise, one missing comma or apostrophe and it can break your site.

    Thanks!

    Thread Starter srw96601

    (@srw96601)

    I appreciate that! I tried to implement via functions file but it has no effect. Not sure what I’m doing wrong- I modified to be this:

    add_filter( ‘give_payment_gateways’, ‘my_custom_gateway_labels’ );

    /**
    * A local translation snippet. Change ‘YOUR TEXT HERE’ to your desired text.
    *
    * @param $translations
    * @param $text
    * @param $domain
    *
    * @return string
    */
    function my_give_text_switcher( $translations, $text, $domain ) {
    // changes the “Donations” text in multiple places
    if ( $domain == ‘give’ && $text == ‘Donation’ ) {
    return __( ‘Payment’, ‘give’ );
    }

    return $translations;
    }

    add_filter( ‘gettext’, ‘my_give_text_switcher’, 10, 3 );

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Change $text == 'Donation' to $translations == 'Donation'

    Also keep in mind that the “Donation” has to be the full string of what you are translating. You cannot just change one word unless that word is is in the plugin by itself (which in the case of Donation it might be).

    Thanks!

    Thread Starter srw96601

    (@srw96601)

    Oh, ok excellent, thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Extensive changes to Text’ is closed to new replies.