【发布时间】:2014-03-05 02:36:46
【问题描述】:
我正在使用 WPML 3.0.2-a 和 WordPress 3.8.1
我有一个这样定义的自定义帖子类型:
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%/
都显示 WordPress 主题的 index.php 模板。它实际上是 404 页面,但由于我们没有 404.php,所以使用 index.php。
展示文章类型在 WPML 设置中可翻译。
您知道这是为什么以及如何解决吗?
【问题讨论】:
标签: php wordpress custom-post-type wpml