自定义文章类型代码生成
通过输入相关参数生成自定义文章类型代码,然后复制到您自己的项目中,通过该方法简化了操作。
/*--------------------------- post type here--------------*/
add_action('init', '');
function () {
$labels = array( 'name' => _x( '', 'post type general name' ),
'singular_name' => _x( '', 'post type singular name' ),
'add_new' => _x( 'Add New', 'post' ),
'add_new_item' => __( 'Add New ' ),
'edit_item' => __( 'Edit ' ),
'new_item' => __( 'New ' ),
'all_items' => __( 'All ' ),
'view_item' => __( 'View ' ),
'search_items' => __( 'Search ' ),
'not_found' => __( 'No found' ),
'not_found_in_trash' => __( 'No found' ),
'parent_item_colon' => '',
'menu_name' => ''
);
$args = array(
'labels' => $labels,
'description' => ' posts',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'publicly_queryable' => true,
'menu_position' => 5,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true, 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
'menu_icon' => '',
);
register_post_type( '', $args );
register_taxonomy("", '', array("hierarchical" => true, "label" => " Category",'show_admin_column' => true, "singular_label" => "_page Category","rewrite" => true) );
}
add_action('init', '');
function () {
$labels = array( 'name' => _x( '', 'post type general name' ),
'singular_name' => _x( '', 'post type singular name' ),
'add_new' => _x( 'Add New', 'post' ),
'add_new_item' => __( 'Add New ' ),
'edit_item' => __( 'Edit ' ),
'new_item' => __( 'New ' ),
'all_items' => __( 'All ' ),
'view_item' => __( 'View ' ),
'search_items' => __( 'Search ' ),
'not_found' => __( 'No found' ),
'not_found_in_trash' => __( 'No found' ),
'parent_item_colon' => '',
'menu_name' => ''
);
$args = array(
'labels' => $labels,
'description' => ' posts',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'publicly_queryable' => true,
'menu_position' => 5,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true, 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
'menu_icon' => '',
);
register_post_type( '', $args );
register_taxonomy("", '', array("hierarchical" => true, "label" => " Category",'show_admin_column' => true, "singular_label" => "_page Category","rewrite" => true) );
}