我创建了一个简单的自定义帖子类型。在我的wordpress站点中,permalinks设置为Post Name。
在自定义帖子类型的帖子的管理屏幕中,不显示permalink编辑器。
我怎样才能像默认帖子类型一样显示出来?
这就是我创建定义的方式:
function register_cpt_staff_member() {
$labels = array(
\'name\' => __( \'staff\', \'staff-member\' ),
\'singular_name\' => __( \'staff-member\', \'staff-member\' ),
\'add_new\' => __( \'Add New\', \'Staff Member\' ),
\'add_new_item\' => __( \'Add New Staff Member\', \'staff_member\' ),
\'edit_item\' => __( \'Edit Staff Member\', \'staff_member\' ),
\'new_item\' => __( \'New Staff Member\', \'staff_member\' ),
\'view_item\' => __( \'View Staff Member\', \'staff_member\' ),
\'search_items\' => __( \'Search Staff Members\', \'staff_member\' ),
\'not_found\' => __( \'No results found\', \'staff_member\' ),
\'not_found_in_trash\' => __( \'No staff found in Trash\', \'staff_member\' ),
\'parent_item_colon\' => __( \'Parent Staff Member:\', \'staff_member\' ),
\'menu_name\' => __( \'Staff\', \'Staff_member\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', \'custom-fields\' ),
\'public\' => false,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 5,
\'show_in_nav_menus\' => false,
\'publicly_queryable\' => true,
\'exclude_from_search\' => true,
\'has_archive\' => false,
\'query_var\' => true,
\'can_export\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\'
);
register_post_type( \'staff_member\', $args );
}
SO网友:Tansukh Parmar
function testimonials_custome_post(){
$labels = array(
\'name\' => __(\'Testimonials\', \'testimonials\'),
\'singular_name\' => __(\'Testimonials\', \'testimonials\'),
\'add_new\' => __(\'New Testimonials\', \'testimonials\'),
\'add_new_item\' => __(\'Add new Testimonials\', \'testimonials\'),
\'edit_item\' => __(\'Edit Testimonials\', \'testimonials\'),
\'new_item\' => __(\'New Testimonials\', \'testimonials\'),
\'view_item\' => __(\'View Testimonials\', \'testimonials\'),
\'search_item\' => __(\'Search Testimonials\', \'testimonials\'),
\'not_found\' => __(\'No The Testimonials Found\', \'testimonials\'),
\'not_found_in_trash\' => __(\'No The Testimonials found in trash\', \'testimonials\')
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'menu_icon\' => \'dashicons-pressthis\',
\'supports\' => array(
\'title\',
\'editor\',
),
);
register_post_type(\'testimonials\', $args);
}
add_action(\'init\', \'testimonials_custome_post\' );
自定义岗位工作代码