Created
May 18, 2011 09:17
-
-
Save mattboon/978263 to your computer and use it in GitHub Desktop.
Guide Custom Post Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// CUSTOM POST TYPE | |
add_action('init', 'matt_guide_register'); | |
function matt_guide_register() { | |
$labels = array( | |
'name' => _x('Guide', 'post type general name'), | |
'singular_name' => _x('Region', 'post type singular name'), | |
'add_new' => _x('Add new region', 'region item'), | |
'add_new_item' => __('Add new'), | |
'edit_item' => __('Edit region'), | |
'new_item' => __('New region'), | |
'view_item' => __('View region'), | |
'search_items' => __('Search regions'), | |
'not_found' => __('Nothing found'), | |
'not_found_in_trash' => __('Nothing found in Trash'), | |
'parent_item_colon' => '' | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'query_var' => true, | |
'capability_type' => 'page', | |
'hierarchical' => true, | |
'menu_position' => null, | |
'rewrite' => array('slug' => 'guide', 'with_front' => true), | |
'supports' => array('title','editor','thumbnail','page-attributes','revisions') | |
); | |
register_post_type( 'guide' , $args ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One more suggestion, instead of adding it once to the file and then loading a page to flush the rewrite rules, you can simply visit the permalinks setting page. It does that too :)