首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不同语言的WordPress管理面板

不同语言的WordPress管理面板
EN

Stack Overflow用户
提问于 2018-04-16 09:28:08
回答 1查看 175关注 0票数 0

我试图将WordPress管理面板的语言更改为意大利语,当我从设置中更改它时,它正在更改管理面板的语言。

但是,当我在子主题中注册自定义post类型时,后端的自定义post类型菜单并没有进入意大利语。下面是我注册自定义post类型的代码。

代码语言:javascript
复制
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);
}

我用的是甘特里氦的主题。请帮帮忙!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-16 09:35:17

尝试将load_theme_textdomain( 'g5_helium', THEMEPATH . '/languages' );添加到functions.php文件的顶部。

更新:您可能要尝试的是从父主题加载文本域。比如:

代码语言:javascript
复制
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目录中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49853887

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档