child theme and languages files

  • Xenon69

    #3820

    Hi, all

    I try to use specific language file in a child theme form graphene theme, uploading .mo file in subfolder “languages” under chil theme folder, but it doesn’t work (.mo file works when uploaded in graphene’s theme languages folder.

    My question is : is there somewhere something to change / configure to tells wordpress to use my own .mo file in child theme subfolder ?

    Thanks

    Fred

    Admin

    Syahir Hakim

    #26133

    You need to use and register a separate textdomain for your child theme. Assuming you’re placing the language files inside a languages folder inside your child theme, the following code will tell WordPress to load a separate language file for your child theme:

    add_action( 'after_setup_theme', 'graphene_child_setup' );
    function graphene_child_setup() {

    /* Load the child theme's gettext file */
    load_child_theme_textdomain( 'textdomain', get_stylesheet_directory() . '/languages' );

    }

    The code above goes into your child theme’s functions.php file. Replace textdomain with the actual textdomain that you use.

    Xenon69

    #26134

    Great !

    Thanks.

    Fred

Viewing 3 posts - 1 through 3 (of 3 total)

  • You must be logged in to reply to this topic.