Last active
December 20, 2015 01:19
-
-
Save ErikBernskiold/6048106 to your computer and use it in GitHub Desktop.
Function for loading a textdomain into a WordPress theme.
This file contains 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
/** | |
* Makes theme available for the built-in localization | |
**/ | |
function xld_localization_support(){ | |
$locale = get_locale(); | |
load_theme_textdomain( 'textdomain', get_template_directory() . '/languages' ); | |
$locale_file = get_template_directory() . "/languages/$locale.php"; | |
if ( is_readable( $locale_file ) ){ | |
require_once( $locale_file ); | |
} | |
} | |
add_action( 'init', 'xld_localization_support' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment