Hab Exam Post type
// Register Custom Post Type
function hab_exam_post_type() {
$labels = array(
'name' => _x( 'Các câu hỏi', 'Post Type General Name', 'hab-exam-domain' ),
'singular_name' => _x( 'Câu hỏi', 'Post Type Singular Name', 'hab-exam-domain' ),
'menu_name' => __( 'Câu hỏi bài thi', 'hab-exam-domain' ),
'name_admin_bar' => __( 'Câu hỏi bài thi', 'hab-exam-domain' ),
'archives' => __( 'Lưu trữ', 'hab-exam-domain' ),
'attributes' => __( 'Thuộc tính', 'hab-exam-domain' ),
'parent_item_colon' => __( 'Mục cha:', 'hab-exam-domain' ),
'all_items' => __( 'Tất cả', 'hab-exam-domain' ),
'add_new_item' => __( 'Thêm mục mới', 'hab-exam-domain' ),
'add_new' => __( 'Thêm mới', 'hab-exam-domain' ),
'new_item' => __( 'Thêm mới', 'hab-exam-domain' ),
'edit_item' => __( 'Sửa', 'hab-exam-domain' ),
'update_item' => __( 'Cập nhật', 'hab-exam-domain' ),
'view_item' => __( 'Xem', 'hab-exam-domain' ),
'view_items' => __( 'Xem nhiều', 'hab-exam-domain' ),
'search_items' => __( 'Tìm kiếm', 'hab-exam-domain' ),
'not_found' => __( 'Không tìm thấy', 'hab-exam-domain' ),
'not_found_in_trash' => __( 'Không tìm thấy trong Thùng rác', 'hab-exam-domain' ),
'featured_image' => __( 'Ảnh đại diện', 'hab-exam-domain' ),
'set_featured_image' => __( 'Đặt ảnh đại diện', 'hab-exam-domain' ),
'remove_featured_image' => __( 'Xoá ảnh đại diện', 'hab-exam-domain' ),
'use_featured_image' => __( 'Sử dụng làm ảnh đại diện', 'hab-exam-domain' ),
'insert_into_item' => __( 'Chèn vào mục', 'hab-exam-domain' ),
'uploaded_to_this_item' => __( 'Đã tải lên mục này', 'hab-exam-domain' ),
'items_list' => __( 'Danh sách mục', 'hab-exam-domain' ),
'items_list_navigation' => __( 'Câu hỏi bài thi', 'hab-exam-domain' ),
'filter_items_list' => __( 'Lọc danh sách', 'hab-exam-domain' ),
);
$capabilities = array(
'edit_post' => 'edit_question',
'read_post' => 'read_question',
'delete_post' => 'delete_question',
'edit_posts' => 'edit_questions',
'edit_others_posts' => 'edit_others_questions',
'publish_posts' => 'publish_questions',
'read_private_posts' => 'read_private_questions',
);
$args = array(
'label' => __( 'Câu hỏi', 'hab-exam-domain' ),
'description' => __( 'Phần này dành cho việc tạo câu hỏi thi', 'hab-exam-domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'trackbacks', 'revisions', 'custom-fields', 'post-formats' ),
'taxonomies' => array( 'hab-question' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-book',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'rewrite' => false,
'capabilities' => $capabilities,
'show_in_rest' => true,
);
register_post_type( 'question', $args );
}
add_action( 'init', 'hab_exam_post_type', 0 );