Skip to content

Instantly share code, notes, and snippets.

@jeffsebring
Created October 18, 2012 22:29
Show Gist options
  • Save jeffsebring/3915159 to your computer and use it in GitHub Desktop.
Save jeffsebring/3915159 to your computer and use it in GitHub Desktop.
Create Custom Post Type
<?php
add_action( 'init', function()
{
register_post_type( 'code',
array(
'labels' => array(
'name' => _x( 'Code', 'post type general name' ),
'singular_name' => _x( 'Code', 'post type singular name' ),
'add_new' => _x( 'Add New', 'Code' ),
'add_new_item' => __( 'Add New Code' ),
'edit_item' => __( 'Edit Code' ),
'new_item' => __( 'New Code' ),
'all_items' => __( 'All Code' ),
'view_item' => __( 'View Code' ),
'search_items' => __( 'Search Code' ),
'not_found' => __( 'No Code found' ),
'not_found_in_trash' => __( 'No Code found in Trash' ),
'parent_item_colon' => '',
'menu_name' => __( 'Code' )
),
'public' => true,
'has_archive' => true,
'hierarchical' => false,
'capability_type' => 'post',
'supports' => array(
'title',
'editor',
'thumbnail',
'page-attributes'
)
)
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment