Skip to content

Instantly share code, notes, and snippets.

@asimpson
Created August 14, 2012 13:59
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 asimpson/3349465 to your computer and use it in GitHub Desktop.
Save asimpson/3349465 to your computer and use it in GitHub Desktop.
Easy way to pull down a Custom Post Type Boilerplate
<?php
function function_cpt() {
$post_type_args = array(
'label' => "Label",
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'query_var' => true,
'rewrite' => array(
'with_front' => false,
'slug' => 'slug'
),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' )
);
register_post_type( 'name', $post_type_args );
}
add_action( 'init', 'function_cpt' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment