Is it possible to target a text change on a single site within a multisite network?

Hi,

Is it possible to target a text change on a single site within a multisite network?

I have the branding module active and Network Wide Text Changes active but from my past understanding this wont target a change on a single site within a network.

Is there any method to achieve this so changes only apply to one site (not globally)?

Thanks
Chris

  • Jude
    • DEV MAN

    Howdy @chris

    You can do this with a text snippet like below.

    function custom_wc_text( $translated_text, $untranslated_text, $domain ) {
    
        if ( 3 == get_current_blog_id() ) {
    
        switch ( $untranslated_text ) {
    
                case 'Billing Details' :
                $translated_text = 'Shipping Details' ;
                break;
            }
        }
        return $translated_text;
    }
    
    add_filter( 'gettext', 'custom_wc_text', 20, 3 );

    Replace the site ID , and the before and after texts and then just copy/paste the code into the functions.php file of your child theme or a site specific plugin if you use one.

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.