Last active
August 29, 2015 14:07
-
-
Save fxbenard/03294a92e5432206f739 to your computer and use it in GitHub Desktop.
WooThemes load textdomain in child theme my own way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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