Products
GG网络技术分享 2025-03-18 16:12 4
I am trying to change the language of WordPress admin panel to Italian, and it\'s changing the language of the administration panel when I change it from Settings.
but when I registered the custom post type in my child theme, the custom post type menus in back-end are not getting into the Italian language.
below is my code for registering custom post type.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);
}
I am using Gantry Helium theme. Please Help!
图片转代码服务由CSDN问答提供
感谢您的意见,我们尽快改进~
功能建议我正在尝试将WordPress管理面板的语言更改为意大利语,并且它正在更改管理面板的语言 我从设置中更改了它。</ p>
但是当我在我的子主题中注册自定义帖子类型时,后端的自定义帖子类型菜单没有进入意大利语。
我的注册自定义帖子类型的代码。</ p>
add_action(\'init\',\'create_posttype_services\'); function create_posttype_services(){
$ labels = array(
\'name\'=&gt; __(\'服务\',\'g5_helium\'),
\'singular_name\'=&gt; __(\'服务\',\'g5_helium\'),
\'add_new\'=&gt; __(\'添加服务\' ,\'g5_helium\'),
\'add_new_item\'=&gt; __(\'添加服务\',\'g5_helium\'),
\'edit_item\'=&gt; __(\'编辑服务\',\'g5_helium\'),
\'new_item \'=&gt; __(\'新服务\',\'g5_helium\'),
\'all_items\'=&gt; __(\'所有服务\',\'g5_helium\'),
\'view_item\'=&gt; __(\'查看服务\' , \'g5_helium\'),
\'search_items\'=&gt; __(\'搜索服务\',\'g5_helium\'),
\'not_found\'=&gt; __(\'无服务\',\'g5_helium\'),
\'not_found_in_trash\'=&gt; __(\'在垃圾箱中找不到服务\',\'g5_helium\'),
\'parent_item_colon\'=&gt; \'\',
\'menu_name\'=&gt; __(\'服务\',\'g5_helium\'),
);
$ args = array(
\'labels\'=&gt; $ labels,
\'public\'=&gt; true,
\'public_queryable\'=&gt ; true,
\'show_ui\'=&gt; true,
\'show_in_menu\'=&gt; true,
\'query_var\'=&gt; true,
\'重写\'=&gt; true,
\'capability_type\'=&gt ;\'post\',
\'has_archive\'=&gt; false,
\'hierarchical\'=&gt; false,
\'支持\'=&gt;数组(\'title\',“editor”),
);
register_post_type(\'services\',$ args);
}
</ code> </ pre>
我正在使用龙门氦主题。 请帮忙!</ p>
</ div>
网友观点:
Try to add load_theme_textdomain( \'g5_helium\', THEMEPATH . \'/languages\' );
at the top of your functions.php
file.
Update: What you might want to try is to load the text-domain from the parent theme as well. Like:
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\' );
After this step make sure you placed those .po
and .mo
files into the /wp-content/themes/child-theme/languages
directory.
Demand feedback