Created
January 30, 2018 09:23
-
-
Save zalog/7aafc5e49d008b917501c23e63308f71 to your computer and use it in GitHub Desktop.
wordpress: change language for theme only
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 default translated strings based on locale | |
load_default_textdomain(); | |
// theme translated strings, modify as you need | |
load_theme_textdomain( 'zatheme', get_template_directory() . '/languages' ); |
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 | |
/** | |
* Plugin Name: plugin | |
* Description: plugin custom | |
* Version: 1.0.0 | |
*/ | |
// prevent direct access | |
defined('ABSPATH') or die(); | |
add_filter('locale', 'zatheme_locale'); | |
function zatheme_locale($locale) { | |
if ( !is_admin() ) { | |
// modify as you need | |
$locale = 'en_US'; | |
} | |
return $locale; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment