Skip to content

Instantly share code, notes, and snippets.

@fxbenard
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fxbenard/03294a92e5432206f739 to your computer and use it in GitHub Desktop.
Save fxbenard/03294a92e5432206f739 to your computer and use it in GitHub Desktop.
WooThemes load textdomain in child theme my own way
<?php
/*
* Load my own woo-load-textdomain function
* Thanks to @grabbler for is help
*/
add_action( 'after_setup_theme', 'woo_load_textdomain', 10 );
function woo_load_textdomain(){
$locale = get_locale();
$domain = 'woothemes';
if ( $loaded = load_theme_textdomain( $domain, WP_LANG_DIR . '/wootheme-theme-slug/' ) ) {
return $loaded;
} elseif ( $loaded = load_theme_textdomain( $domain, get_stylesheet_directory() . '/lang/' ) ) {
return $loaded;
} else {
load_theme_textdomain( $domain, get_template_directory() . '/lang/' );
}
if( is_child_theme() ) {
$domain = 'wootheme-theme-slug-child';
$mofile = get_stylesheet_directory() . "/lang/{$domain}-{$locale}.mo";
load_textdomain( $domain, $mofile );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment