I just made a custom post type. How do I display the Tag panel on the sidebar same as what the Post post type has?
3条回答 默认 最新
- drgmszo076956 2012-04-20 11:45关注
add this line to the section you
register_post_type
in functions.php in your theme folder'taxonomies' => array('category', 'post_tag')
The full code is looks like this
add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'posttypename', array( 'labels' => array( 'name' => __( 'PostTypeName' ), 'singular_name' => __( 'PostTypeName' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'posttypename'), 'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'thumbnail' ), 'taxonomies' => array('category', 'post_tag') // this is IMPORTANT ) ); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 chaquopy python 安卓
- ¥50 Kubernetes&Fission&Eleasticsearch
- ¥15 有没有帮写代码做实验仿真的
- ¥15 報錯:Person is not mapped,如何解決?
- ¥30 vmware exsi重置后登不上
- ¥15 易盾点选的cb参数怎么解啊
- ¥15 MATLAB运行显示错误,如何解决?
- ¥15 c++头文件不能识别CDialog
- ¥15 Excel发现不可读取的内容
- ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题