Skip to content

Instantly share code, notes, and snippets.

@seanwash
Created July 19, 2012 14:58
Show Gist options
  • Save seanwash/3144520 to your computer and use it in GitHub Desktop.
Save seanwash/3144520 to your computer and use it in GitHub Desktop.
Wordpress: Wordpress Register Custom Post Type
add_action( 'init', 'create_events' );
function create_events() {
$labels = array(
'name' => _x('Events', 'post type general name'),
'singular_name' => _x('Event', 'post type singular name'),
'add_new' => _x('Add New', 'Event'),
'add_new_item' => __('Add New Event'),
'edit_item' => __('Edit Event'),
'new_item' => __('New Event'),
'view_item' => __('View Event'),
'search_items' => __('Search Events'),
'not_found' => __('No Events found'),
'not_found_in_trash' => __('No Events found in Trash'),
'parent_item_colon' => ''
);
$supports = array('title', 'editor', 'custom-fields', 'revisions', 'excerpt');
register_post_type( 'event',
array(
'labels' => $labels,
'public' => true,
'supports' => $supports
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment