http://blog.wpjam.com/article/wordpress-post-type/
<?php
function my_custom_post_course() {
$labels = array(
'name' => _x( 'course', 'post type 名称' ),
'singular_name' => _x( 'course', 'post type 单个 item 时的名称,因为英文有复数' ),
'add_new' => _x( '新建课程', '添加新内容的链接名称' ),
'add_new_item' => __( '添加一个课程' ),
'edit_item' => __( '编辑课程' ),
'new_item' => __( '新课程' ),
'all_items' => __( '所有课程' ),
'view_item' => __( '查看课程' ),
'search_items' => __( '搜索课程' ),
'not_found' => __( '没有找到有关课程' ),
'not_found_in_trash' => __( '回收站里面没有相关课程' ),
'parent_item_colon' => '',
'menu_name' => 'course'
);
$args = array(
'labels' => $labels,
'description' => '我们网站的课程信息',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true
);
register_post_type( 'course', $args );
}
add_action( 'init', 'my_custom_post_course' );
?>
<?
function my_taxonomies_course() {
$labels = array(
'name' => _x( '课程分类', 'taxonomy 名称' ),
'singular_name' => _x( '课程分类', 'taxonomy 单数名称' ),
'search_items' => __( '搜索课程分类' ),
'all_items' => __( '所有课程分类' ),
'parent_item' => __( '该课程分类的上级分类' ),
'parent_item_colon' => __( '该课程分类的上级分类:' ),
'edit_item' => __( '编辑课程分类' ),
'update_item' => __( '更新课程分类' ),
'add_new_item' => __( '添加新的课程分类' ),
'new_item_name' => __( '新课程分类' ),
'menu_name' => __( '课程分类' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
);
register_taxonomy( 'movie_course', 'course', $args );
}
add_action( 'init', 'my_taxonomies_course', 0 );
?>