在functions.php文件中添加以下代码:
add_action('init', 'cptui_register_my_cpt_miniblog'); function cptui_register_my_cpt_miniblog() { register_post_type('miniblog', array( 'label' => '微博客', 'description' => '一个微博客', 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => array('slug' => 'miniblog', 'with_front' => true), 'query_var' => true, 'menu_icon' => 'https://www.nixonli.com/wp-content/themes/nixonli/img/weibo.png', 'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes','post-formats'), 'taxonomies' => array('post_tag'), 'labels' => array ( 'name' => '微博客', 'singular_name' => '微博客', 'menu_name' => '微博客', 'add_new' => '添加', 'add_new_item' => '添加微博客', 'edit' => '编辑', 'edit_item' => '编辑微博客', 'new_item' => '新微博客', 'view' => '查看', 'view_item' => '查看微博客', 'search_items' => '搜索微博客', 'not_found' => '未找到', 'not_found_in_trash' => '在回收站中没有找到', 'parent' => '父级', ) ) ); }