问题描述
所以我用register_post_type添加了书的post_type部分。
但是我想在后面板edit.PHP上显示类别和标签(以及更多)。
add_action( 'init','bookworm_blog_cpt' );
function bookworm_blog_cpt() {
register_post_type( 'book',array(
'labels' => array(
'name' => 'Books','singular_name' => 'Book',),'description' => 'Books which we will be discussing on this blog.','public' => true,'menu_position' => 20,'supports' => array( 'title','editor','excerpt','thumbnail','custom-fields' )
));
}
解决方法
您需要使用钩子将自定义列添加到帖子类型索引中,需要使用3个或4个钩子,因此在此处发布示例可能会花费很长的时间,并且可能会更加混乱。
本文介绍了以下主题:http://justintadlock.com/archives/2011/06/27/custom-columns-for-custom-post-types
如果您不想使用该教程,则只需Google“将自定义列添加到自定义帖子类型索引”,您将有很多选择。希望这有助于您走上正确的道路。