• FrauK

    (@schreikrampf)


    Hello,

    I’m working for days now on the problem of english words within woocommerce on my german website. Now I found a solution for changing the words “Recent Products” and “Checkout”, I put this on my functions.php of the Mystile Theme and it worked.

    add_filter( 'gettext', 'kia_text_strings', 20, 3 );**
     * Change text strings
     *
     * @link https://codex.www.ads-software.com/Plugin_API/Filter_Reference/gettext
     */
    function kia_text_strings( $translated_text, $text, $domain ) {
    
            switch ( $translated_text ) {
    
                case 'Checkout' :
    
                    $translated_text = __( 'Kasse', 'ftp://[email protected]/clickandbuilds/artekatzshop/wp-content/languages/de_DE.po' );
                    break;
    
                case 'Recent Products' :
    
                    $translated_text = __( 'Unsere Empfehlungen', 'ftp://[email protected]/clickandbuilds/artekatzshop/wp-content/languages/de_DE.po' );
                    break;
    
                case 'Search Product' :
    
                    $translated_text = __( 'Suche', 'ftp://[email protected]/clickandbuilds/artekatzshop/wp-content/languages/de_DE.po' );
                    break;
            }
    
        return $translated_text;
    }

    The Problem now: If I klick on “Kasse” (what was Checkout before) I get the following issue report: “Warning: Cannot modify header information – headers already sent by (output started at /homepages/39/d73891982/htdocs/clickandbuilds/artekatzshop/wp-includes/functions.php:1) in /homepages/39/d73891982/htdocs/clickandbuilds/artekatzshop/wp-includes/pluggable.php on line 1121”

    What do I have to do now to solve this?
    Would love to get your support!
    Thanks. ??

    You can see the website here: https://www.zabird.de

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter FrauK

    (@schreikrampf)

    Maybe this could help too:
    This is what stays around line 1121 in pluggable.php

    if ( ! $location )
    		return false;
    
    	$location = wp_sanitize_redirect($location);
    
    	if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
    		status_header($status); // This causes problems on IIS and some FastCGI setups
    
    	header("Location: $location", true, $status);
    
    	return true;
    }
    endif;

    Hi schreikrampf. I’ve been trying very hard to use the get_text kia_text_string code to change the words product and categories to an appropriate title for my friend’s dog breed website. I just want it to say puppies instead of products. And instead of categories I would like puppy breeds. But I have tried without success to use that code. I have two questions for you- 1. How did you fix the problem you were having with the headers error? I got that error too (originally) and fixed it by moving the location of the code in my function.php file in my theme folder. However, the words do not get replaced because I do not what to replace for ‘Theme_text_domain’. I wanted to follow your example, and put my acutal domain in there- but I was unable to locate an ENGLISH language PO file. I don’t have a folder called Language under WP-includes.
    How did you get it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Theme: Mystile] Cannot modify header information’ is closed to new replies.