Skip to content

Instantly share code, notes, and snippets.

@chrisvanpatten
Created May 3, 2013 17:57
Show Gist options
  • Save chrisvanpatten/5512022 to your computer and use it in GitHub Desktop.
Save chrisvanpatten/5512022 to your computer and use it in GitHub Desktop.
Simple bit of code to register a custom post type. Use as an mu-plugin.
<?php
/*
Plugin Name: show Custom Post Type
Plugin URI: http://www.offbroadway.com/
Description: Custom post type for OffBroadway.com
Author: Van Patten Media
Version: 1.0
Author URI: http://www.vanpattenmedia.com/
*/
/**
*
* Register post type
*
*/
if ( !post_type_exists('show') ) {
function register_show_type() {
$label_singular = 'Show';
$label_plural = 'Shows';
register_post_type(
'show',
array(
'label' => $label_plural,
'description' => '',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'hierarchical' => false,
'query_var' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'show',
'with_front' => false,
),
'supports' => array(
'title',
'editor',
'revisions',
'thumbnail',
'custom-fields',
),
'labels' => array (
'name' => $label_plural,
'singular_name' => $label_singular,
'menu_name' => $label_plural,
'add_new' => 'Add New',
'add_new_item' => 'Add New ' . $label_singular,
'edit' => 'Edit',
'edit_item' => 'Edit ' . $label_singular,
'new_item' => 'New ' . $label_singular,
'view' => 'View ' . $label_singular,
'view_item' => 'View ' . $label_singular,
'search_items' => 'Search ' . $label_plural,
'not_found' => 'No ' . $label_plural . ' Found',
'not_found_in_trash' => 'No ' . $label_plural . ' Found in Trash',
'parent' => 'Parent ' . $label_singular,
)
)
);
}
add_action('init', 'register_show_type');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment