0
저는 Wordpress에서 사용자 정의 게시 유형을 만들었습니다. 게시물 유형 이름이있는 기사에 레이블을 표시하려고합니다.번역 사용자 지정 게시 유형
<?php echo get_post_type(); ?>
그것은 영어 이름을 출력합니다
나는이 작업을 수행.
이제 Poedit으로 번역하고 싶지만 작동하지 않습니다. 내 사용자 정의 포스트 유형은 다음과 같습니다
<?php
function register_cpt_news() {
$singular = 'News';
$plural = 'News';
$labels = array(
'name' => _x($plural, 'ndi'),
'singular_name' => _x($singular, 'ndi'),
'menu_name' => _x('News', 'ndi'),
'name_admin_bar' => _x($singular, 'ndi'),
'add_new' => __('Add New'),
'add_new_item' => __('Add New '.$singular),
'new_item' => __('New '.$singular),
'edit_item' => __('Edit '.$singular),
'view_item' => __('View '.$singular),
'all_items' => __('All '.$plural),
'search_items' => __('Search '.$plural),
'parent_item_colon' => __('Parent '.$plural.':'),
'not_found' => __('No '.$plural.' found.'),
'not_found_in_trash' => __('No '.$plural.' found in Trash.'),
);
$args = array(
'label' => __($plural, 'ndi'),
'labels' => $labels,
'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions',),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 4,
'can_export' => true,
'has_archive' => true ,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-format-aside',
);
register_post_type('news', $args);
}
add_action('init', 'register_cpt_news');
?>
와트는 내가 잘못하고 있는가? 당신이 영어를 만든 영어 사용 레이블 이름
$title_lan = $obj->labels->name ;
echo $title_lan ;
하여 사용자 정의 포스트 이름을 에코 할 때 사용자 정의 게시물을 등록 할 때