Skip to content

Instantly share code, notes, and snippets.

@pkarjala
Last active August 29, 2015 14:18
Show Gist options
  • Save pkarjala/d827a96d029294ed4485 to your computer and use it in GitHub Desktop.
Save pkarjala/d827a96d029294ed4485 to your computer and use it in GitHub Desktop.
Performance Task Post Type Creation
$performance_task_labels = array(
'name' => _x( 'Performance Tasks', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Performance Task', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Performance Task', 'text_domain' ),
'name_admin_bar' => __( 'Performance Task', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'Performance Tasks', 'text_domain' ),
'add_new_item' => __( 'Add New Performance Task', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'new_item' => __( 'New Performance Task', 'text_domain' ),
'edit_item' => __( 'Edit Performance Task', 'text_domain' ),
'update_item' => __( 'Update Performance Task', 'text_domain' ),
'view_item' => __( 'View Performance Task', 'text_domain' ),
'search_items' => __( 'Search Performance Tasks', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
);
$performance_task_capabilities = array(
'edit_post' => 'edit_performance_task',
'read_post' => 'read_performance_task',
'delete_post' => 'delete_performance_task',
'edit_posts' => 'edit_performance_task',
'edit_others_posts' => 'edit_others_performance_tasks',
'publish_posts' => 'publish_performance_task',
'read_private_posts' => 'read_private_performance_task',
);
$performance_task_args = array(
'label' => __( 'performance_task', 'text_domain' ),
'description' => __( 'Performance Task', 'text_domain' ),
'labels' => $performance_task_labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
'taxonomies' => array( 'category', 'post_tag' ),
'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' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => false,
'capabilities' => $performance_task_capabilities,
);
register_post_type( 'performance_task', $performance_task_args );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment