Created
February 9, 2012 17:32
-
-
Save madysondesigns/1781441 to your computer and use it in GitHub Desktop.
Custom post type
This file contains 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
Want my newsroom to be url.com/newsroom (currently throws a 404) | |
Posts should be url.com/newsroom/post-title (currently works) | |
Code in functions.php: | |
// newsroom custom content type | |
function bment_post_type_newsroom() { | |
register_post_type( | |
'newsroom', array( | |
'labels' => array( | |
'name' => __( 'Newsroom' ), | |
'singular_name' => __( 'News Article' ), | |
'add_new' => __( 'Add New' ), | |
'add_new_item' => __( 'Add New News Article' ), | |
'edit' => __( 'Edit' ), | |
'edit_item' => __( 'Edit News Article' ), | |
'new_item' => __( 'New News Article' ), | |
'view' => __( 'View News Article' ), | |
'view_item' => __( 'View News Article' ), | |
'search_items' => __( 'Search News Articles' ), | |
'not_found' => __( 'No news articles found' ), | |
'not_found_in_trash' => __( 'No news articles found in Trash' ), | |
'parent' => __( 'Newsroom' ), | |
), | |
'public' => true, | |
'show_ui' => true, | |
'menu_position' => 20, | |
'hierarchical' => true, | |
'supports' => array( | |
'title', | |
'editor', | |
'excerpt', | |
'custom-fields', | |
'thumbnail', | |
'page-attributes' | |
), | |
'rewrite' => array( | |
'slug' => 'newsroom', | |
'with_front' => false | |
), | |
)); | |
register_taxonomy_for_object_type('post_tag', 'Newsroom'); | |
} | |
add_action('init', 'bment_post_type_newsroom'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment