I have a post type named "case". I want to create a "Sub-page" to list only my "cases". And add some custom HTML (search box, some labels, logos, etc..)
Anyone knows how can I do this?
Code to create the post_type.
function my_custom_post_type_case() {
$labels = array(
'name' => _x( 'Cases', 'post type general name' ),
'singular_name' => _x( 'Case', 'post type singular name' ),
'add_new' => _x( 'Add New', 'case' ),
'add_new_item' => __( 'Add New Case' ),
'edit_item' => __( 'Edit Case' ),
'new_item' => __( 'New Case' ),
'all_items' => __( 'All Cases' ),
'view_item' => __( 'View Case' ),
'search_items' => __( 'Search Cases' ),
'not_found' => __( 'No cases found' ),
'not_found_in_trash' => __( 'No cases found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Cases'
);
$args = array(
'labels' => $labels,
'description' => 'Business Cases & Teaching Material',
'public' => true,
'menu_icon' => 'dashicons-book',
'menu_position' => 5,
'map_meta_cap' => true,
'capability_type' => array('case', 'cases'),
'capabilities' => array(
'edit_post' => 'edit_case',
'edit_posts' => 'edit_cases',
'edit_others_posts' => 'edit_other_cases',
'publish_posts' => 'publish_cases',
'edit_publish_posts' => 'edit_publish_cases',
'read_post' => 'read_cases',
'read_private_posts' => 'read_private_cases',
'delete_post' => 'delete_case'
),
'supports' => array( 'title', 'editor', 'wpcom-markdown', 'revisions' ),
'has_archive' => false
);
register_post_type( 'case', $args );
}
add_action( 'init', 'my_custom_post_type_case' );
Here is the code to add the "Sub-page".
function register_adminMenu(){
add_submenu_page('edit.php?post_type=case', 'My cases', 'My cases', 'manage_options', 'my_cases', 1);
};
function my_cases(){
include_once(file_to_script);
}
The "include_once(file_to_script);" should be the script where list the "cases". I think that I have to extend the "WP_List_Table" class, but I'm not sure and I can't find this in Internet.
Thanks a lot