• I think I must be missing something about how to change the language settings in a child theme. I have:

    1. Made a new *.po and *.mo (using PoEdit);
    made a /languages/ folder in the child theme;
    put the files here.

    2. Copied the functions.php from the parent theme folder to the child folder;
    deleted everything except the alx_load function;
    changed get_template_directory to get_stylesheet_directory.

    So my functions.php looks like this:

    <?php
    if ( ! function_exists( 'alx_load' ) ) {
    	function alx_load() {
    		// Load theme languages
    		load_theme_textdomain( 'hueman', get_stylesheet_directory().'/languages' );
    		// Load theme options and meta boxes
    		load_template( get_template_directory() . '/functions/theme-options.php' );
    		load_template( get_template_directory() . '/functions/meta-boxes.php' );
    		// Load custom widgets
    		load_template( get_template_directory() . '/functions/widgets/alx-tabs.php' );
    		load_template( get_template_directory() . '/functions/widgets/alx-video.php' );
    		load_template( get_template_directory() . '/functions/widgets/alx-posts.php' );
    		// Load custom shortcodes
    		load_template( get_template_directory() . '/functions/shortcodes.php' );
    		// Load dynamic styles
    		load_template( get_template_directory() . '/functions/dynamic-styles.php' );
    		// Load TGM plugin activation
    		load_template( get_template_directory() . '/functions/class-tgm-plugin-activation.php' );
    	}
    }
    add_action( 'after_setup_theme', 'alx_load' );

    Since it didn’t work, could someone tell me what I am missing? Thanks so much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi KathleenH. I don’t know if this will fix it but the first thing I’d try is removing the “if…” statement and the last } closing bracket. They’re not needed in the child theme. They’re used in the parent theme to see if the function has already been loaded, which would most likely be from a child theme, so it doesn’t try to load it twice.

    Thread Starter KathleenH

    (@kathleenh)

    Unfortunately, no joy… Should I remove the line after the second bracket too? (Actually, just gave that a go and it didn’t work either.)

    Thread Starter KathleenH

    (@kathleenh)

    For the time being I am ‘cheating’, and have simply changed the translation recorded on en_US.mo and en_US.po to the language I needed, and left the files in the parent language folder. However I’d love to know how to do this properly, so if anyone has any suggestions I’d be pleased to know. Many thanks. This is a brilliant theme, Alx, thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change language of child theme’ is closed to new replies.