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!
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.