Skip to content

Instantly share code, notes, and snippets.

@tenomoto
Created April 27, 2016 05:50
Show Gist options
  • Save tenomoto/00a51401cfe1a96a612916264a863dbc to your computer and use it in GitHub Desktop.
Save tenomoto/00a51401cfe1a96a612916264a863dbc to your computer and use it in GitHub Desktop.
Multilingual title and description in WordPress with bogo
add_filter( 'option_blogname', 'tr_option_blogname' );
function tr_option_blogname( $blogname ) {
return __($blogname, 'my-theme-child');
}
add_filter( 'option_blogdescription', 'tr_option_blogdescription' );
function tr_option_blogdescription( $blogdescription ) {
return __($blogdescription, 'my-theme-child');
}
add_action( 'after_setup_theme', 'my_child_theme_setup' );
function my_child_theme_setup(){
load_child_theme_textdomain( 'my-theme-child', get_stylesheet_directory() . '/languages' );
}
#: Site Title
msgid "English Title"
msgstr "日本語のタイトル"
#: Site Description
msgid "Description in English"
msgstr "日本語のキャッチフレーズ"
/*
Theme Name: My Theme Child
Description: My Theme Child Theme
Author: Jonh Doe
Author URI: http://www.example.com
Template: my-theme
Version: 1.0.0
Tags:
Text Domain: my-theme-child
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment