Skip to content

Instantly share code, notes, and snippets.

@ErikBernskiold
Last active December 20, 2015 01:19
Show Gist options
  • Save ErikBernskiold/6048106 to your computer and use it in GitHub Desktop.
Save ErikBernskiold/6048106 to your computer and use it in GitHub Desktop.
Function for loading a textdomain into a WordPress theme.
/**
* 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