Skip to content

Instantly share code, notes, and snippets.

@teolopez
Created April 29, 2014 00:05
Show Gist options
  • Save teolopez/11387553 to your computer and use it in GitHub Desktop.
Save teolopez/11387553 to your computer and use it in GitHub Desktop.
OUHSD – new post type
/* Replace superintendent */
add_action( 'init', 'codex_superintendent_init' );
/**
* Register a superintendent post type.
*
* @link http://codex.wordpress.org/Function_Reference/register_post_type
*/
function codex_superintendent_init() {
$labels = array(
'name' => _x( 'superintendents', 'post type general name', 'your-plugin-textdomain' ),
'singular_name' => _x( 'superintendent', 'post type singular name', 'your-plugin-textdomain' ),
'menu_name' => _x( 'superintendents', 'admin menu', 'your-plugin-textdomain' ),
'name_admin_bar' => _x( 'superintendent', 'add new on admin bar', 'your-plugin-textdomain' ),
'add_new' => _x( 'Add New', 'posts', 'your-plugin-textdomain' ),
'add_new_item' => __( 'Add New posts', 'your-plugin-textdomain' ),
'new_item' => __( 'New posts', 'your-plugin-textdomain' ),
'edit_item' => __( 'Edit posts', 'your-plugin-textdomain' ),
'view_item' => __( 'View posts', 'your-plugin-textdomain' ),
'all_items' => __( 'All postss', 'your-plugin-textdomain' ),
'search_items' => __( 'Search postss', 'your-plugin-textdomain' ),
'parent_item_colon' => __( 'Parent superintendents:', 'your-plugin-textdomain' ),
'not_found' => __( 'No superintendents found.', 'your-plugin-textdomain' ),
'not_found_in_trash' => __( 'No superintendents found in Trash.', 'your-plugin-textdomain' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'superintendent' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'superintendent', $args );
}
// Register Custom Taxonomy
function custom_taxonomy_prefix() {
$labels = array(
'name' => _x( 'Taxonomies', 'Taxonomy General Name', 'text_domain' ),
'singular_name' => _x( 'Taxonomy', 'Taxonomy Singular Name', 'text_domain' ),
'menu_name' => __( 'Taxonomy', 'text_domain' ),
'all_items' => __( 'All Items', 'text_domain' ),
'parent_item' => __( 'Parent Item', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'new_item_name' => __( 'New Item Name', 'text_domain' ),
'add_new_item' => __( 'Add New Item', 'text_domain' ),
'edit_item' => __( 'Edit Item', 'text_domain' ),
'update_item' => __( 'Update Item', 'text_domain' ),
'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
'search_items' => __( 'Search Items', 'text_domain' ),
'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ),
'choose_from_most_used' => __( 'Choose from the most used items', 'text_domain' ),
'not_found' => __( 'Not Found', 'text_domain' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'channels', array( 'post' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'custom_taxonomy', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment