WordPress homepage tagline in other language

I have a homepage tagline for my WordPress website. I have a multilingual plugin installed called Qtranslate x. Now I can have an English version for every page but the title of the homepage remains in Dutch (original language). That is because it is determined in the general theme options section.

Is there anything I can do so that the homepage tagline can also be multilingual?

Related posts

1 comment

  1. A full solution would allow you to define the title(s) via options, but this will get you started in the right direction.

    In your theme’s function file, add this code (that utilizes the wp_title filter):

    add_filter( 'wp_title', 'my_title_filter', 1, 2 );
    
    function my_title_filter($title, $sep) {
    
        // Only do this on the home page!
        if (! is_home() && ! is_front_page()) {
            return $title;
        }        
        // Get the language.  You've not included details, so this code is for the WPML Multilingual CMS plugin
        $language = ICL_LANGUAGE_CODE;
    
        // If the above doesn't work, try this:
        // $language = get_bloginfo("language");
    
        // Change the title based on the language
        switch ($language) {
            case 'en-US':
                return 'My English Title';
            case 'es-ES':
                return 'Mi español Título';
            // Other languages here....
            case 'nl-BE':
            default:
                return $title;
        }
    }
    

    One source (probably not the best) for language Identifiers is here: http://www.i18nguy.com/unicode/language-identifiers.html

Comments are closed.