当我升级我的wordpress到3.9,在管理面板(和现场)更改我的自定义帖子类型mysite.com/custom-post-type -是 mysite.com/archives/custom-post-type - now的permalinks,但这两个链接仍然有效。出什么事了?
发布于 2014-05-07 08:17:03
为了确保问题在数据库Permalink选项中,切换到标准主题之一并检查permalinks,也许在您的主题中值得使用一些可能禁止切换Permalink物种(或不能正常工作)的插件。
发布于 2014-05-02 08:16:48
我已经使用我的插件自定义post类型波纹管代码。它工作正常,你可以看到这个
function wptPostRegister() {
$wptLabels = array(
'name' => 'WPT Slides',
'singular_name' => 'WPT Slid',
'add_new' => 'Add New',
'add_new_item' => 'Add New Slide',
'edit_item' => 'Edit Slide',
'new_item' => 'New Slide',
'all_items' => 'All Slides',
'view_item' => 'View Slide',
'search_items' => 'Search Slide',
'not_found' => 'No slides found',
'not_found_in_trash' => 'No slides found in Trash',
'parent_item_colon' => '',
'menu_name' => 'WPT Slider'
);
$wptCustomPost = array(
'labels' => $wptLabels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array('slug' => 'wptslider'),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title', 'editor', 'thumbnail')
);
register_post_type('wptpost', $wptCustomPost);
}
add_action('init', 'wptPostRegister');.您还应该根据post类型在您的主题上创建一个php文件。例如,我使用了"wptpost-archive.php“
发布于 2014-05-07 08:55:35
噢,您还可以使用模板元素查看单个页面,从而实现wptpost-sinlge.php。
https://stackoverflow.com/questions/23390898
复制相似问题