Skip to content

Instantly share code, notes, and snippets.

@sethrubenstein
Created October 24, 2013 15:52
Show Gist options
  • Save sethrubenstein/7139729 to your computer and use it in GitHub Desktop.
Save sethrubenstein/7139729 to your computer and use it in GitHub Desktop.
<?php
function name_of_post_type_register() {
$labels = array(
'name' => _x( 'Post Type Names', 'post type general name' ),
'singular_name' => _x( 'Post Type Name', 'post type singular name' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Post Type Name' ),
'edit_item' => __( 'Edit Post Type Name' ),
'new_item' => __( 'New Post Type Name' ),
'view_item' => __( 'View Post Type Name' ),
'search_items' => __( 'Search Post Type Name' ),
'not_found' => __( 'No Post Type Name Found' ),
'not_found_in_trash' => __( 'No Post Type Name in Trash' ),
'parent_item_colon' => __( 'Post Type Name' ),
'menu_name' => __( 'Post Type Name' )
);
$taxonomies = array();
$supports = array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions' );
$post_type_args = array(
'labels' => $labels,
'singular_label' => __('Post Type Name'),
'public' => true,
'exclude_from_search' => false,
'show_ui' => true,
'publicly_queryable' => true,
'query_var' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'rewrite' => array('slug' => 'name_of_post_type', 'with_front' => false ),
'supports' => $supports,
'menu_position' => 5,
'taxonomies' => $taxonomies
);
register_post_type('name_of_post_type',$post_type_args);
}
add_action('init', 'name_of_post_type_register');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment