Php 不同语言的WordPress管理面板
我正在尝试将WordPress管理面板的语言更改为意大利语,当我从设置更改它时,它正在更改管理面板的语言 但是,当我在我的子主题中注册自定义post类型时,后端中的自定义post类型菜单没有使用意大利语。 下面是我注册自定义帖子类型的代码Php 不同语言的WordPress管理面板,php,wordpress,multilingual,Php,Wordpress,Multilingual,我正在尝试将WordPress管理面板的语言更改为意大利语,当我从设置更改它时,它正在更改管理面板的语言 但是,当我在我的子主题中注册自定义post类型时,后端中的自定义post类型菜单没有使用意大利语。 下面是我注册自定义帖子类型的代码 add_action('init', 'create_posttype_services'); function create_posttype_services() { $labels = array( 'name' => _
add_action('init', 'create_posttype_services');
function create_posttype_services() {
$labels = array(
'name' => __('Services', 'g5_helium'),
'singular_name' => __('Service', 'g5_helium'),
'add_new' => __('Add Service', 'g5_helium'),
'add_new_item' => __('Add Service', 'g5_helium'),
'edit_item' => __('Edit Service', 'g5_helium'),
'new_item' => __('New Service', 'g5_helium'),
'all_items' => __('All Services', 'g5_helium'),
'view_item' => __('View Service', 'g5_helium'),
'search_items' => __('Search Service', 'g5_helium'),
'not_found' => __('No Service', 'g5_helium'),
'not_found_in_trash' => __('No Services found in Trash', 'g5_helium'),
'parent_item_colon' => '',
'menu_name' => __('Services', 'g5_helium'),
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'supports' => array('title', "editor"),
);
register_post_type('services', $args);
}
我使用的是一个主题。请帮忙 尝试添加
load_theme_textdomain('g5_氦',THEMEPATH./languages')
位于functions.php
文件的顶部
更新:
您可能还想尝试从父主题加载文本域。比如:
function child_theme_slug_setup() {
load_child_theme_textdomain( 'parent-theme-slug', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
完成此步骤后,请确保将这些
.po
和.mo
文件放入/wp content/themes/child-theme/languages
目录中。如何翻译这些字符串?WPML字符串翻译?我正在使用.pot文件,并将我的字符串添加到该文件中。您是从.com英文WP网站下载WP副本,还是仅从.com英文WP网站下载?