我使用WPML 3.0.2-A與WordPress 3.8.1WPML和自定義文章類型的歸檔模板
我有這樣定義的自定義後類型:
function add_custom_posts(){
$args = array(
'labels' => array(
'name' => __('Showcases'),
'singular_name' => __('Showcases'),
'add_new_item' => __('Add New Showcase'),
'edit_item' => __('Edit Showcases'),
'view_item' => __('View Showcase'),
'search_items' => __('Search Showcases'),
'not_found' => __('No Showcases found.'),
'not_found_in_trash' => __('No Showcases found in Trash.')
),
'public' => true,
'has_archive' => 'case-studies',
'menu_position' => 5,
'taxonomies' => array('post_tag'),
'supports' => array('title', 'thumbnail', 'editor', 'excerpt', 'page-attributes'),
'rewrite' => array('slug' => 'case-studies', 'with_front' => false),
'capability_type' => 'post',
'hierarchical' => false,
);
register_post_type('showcases', $args);
}
add_action('init', 'add_custom_posts', 100);
訪問自定義類型後存檔和默認語言的單個帖子URL都可以正常工作。例如:
/case-studies/
/case-studies/%postname%/
正在完美工作,並顯示他們應該。
但是,它並沒有對其他語言的工作:
/de/case-studies/
/de/case-studies/%postname%/
都顯示的index.php的WordPress主題的模板。這實際上是404頁面,但由於我們沒有404.php,使用了index.php。
展示帖子類型在WPML設置中可翻譯。
你知道這是爲什麼嗎?如何解決它?
不幸的是,它並沒有幫助。 :(你有什麼其他的想法嗎? –
完美地工作!確保你的參數與'register_post_type'中的參數匹配 - 可能爲什麼這對Aleksandar不起作用。它應該是'showcases',而不是'case-studies' –