Skip to content

Instantly share code, notes, and snippets.

@andrewahead4
Created October 2, 2015 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewahead4/f8a5f52734f888100fd0 to your computer and use it in GitHub Desktop.
Save andrewahead4/f8a5f52734f888100fd0 to your computer and use it in GitHub Desktop.
add_action( 'init', 'register_cpt_blog_entry' );
function register_cpt_blog_entry() {
$labels = array(
'name' => _x( 'Blog Entries', 'blog_entry' ),
'singular_name' => _x( 'Blog Entry', 'blog_entry' ),
'add_new' => _x( 'Add New', 'blog_entry' ),
'add_new_item' => _x( 'Add New Blog Entry', 'blog_entry' ),
'edit_item' => _x( 'Edit Blog Entry', 'blog_entry' ),
'new_item' => _x( 'New Blog Entry', 'blog_entry' ),
'view_item' => _x( 'View Blog Entry', 'blog_entry' ),
'search_items' => _x( 'Search Blog Entries', 'blog_entry' ),
'not_found' => _x( 'No blog entries found', 'blog_entry' ),
'not_found_in_trash' => _x( 'No blog entries found in Trash', 'blog_entry' ),
'parent_item_colon' => _x( 'Parent Blog Entry:', 'blog_entry' ),
'menu_name' => _x( 'Blog Entries', 'blog_entry' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'An individual blog entry',
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields', 'comments' ),
'taxonomies' => array( 'txblogentry' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'blog_entry', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment