Skip to content

Instantly share code, notes, and snippets.

@mikelyons
Created April 21, 2014 16:49
Show Gist options
  • Save mikelyons/11148497 to your computer and use it in GitHub Desktop.
Save mikelyons/11148497 to your computer and use it in GitHub Desktop.
How to add a custom post type in wordpress 3.41
<?php
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'press-releases',
array(
'public' => true,
'show_ui' => true,
'publicly_queryable' => true,
'has_archive' => true,
'capability_type' => 'post',
'rewrite' => array('slug' => ''),
'menu_position' => 4,
'supports' => array( 'press-releases', 'editor', 'title' ),
'has_archive' => true,
'labels' => array(
'name' => __( 'Press Releases' ),
'singular_name' => __( 'Press Release' ),
'edit_item' => __( 'Edit Press Release' )
)
)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment