Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Hook into the init action and call create_post_type when it fires
- add_action( 'init', 'create_post_type' );
- function create_post_type() {
- $labels = array( // define the name of the custom post type
- 'name' => _x('Articles','custom post type general name'),
- 'singular_name' => _x('Article','custom post type singular name' ),
- 'add_new' => _x('Add New','article'),
- 'add_new_item' => __('Add New Article'),
- 'edit_item' => __('Edit Article'),
- 'new_item' => __('New Article'),
- 'all_items' => __('All Articles'),
- 'view_item' => __('View Article'),
- 'search_items' => __('Search Articles'),
- 'not_found' => __('No articles found'),
- 'not_found_in_trash' => __('No articles found in Trash'),
- 'parent_item_colon' => '',
- 'menu_name' => 'Articles'
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true, // true=show the post type in the admin section
- 'publicly_queryable' => true,
- 'show_ui' => true, // generate a default admin user interface
- 'show_in_menu' => true, // display as a top-level menu item
- 'query_var' => true,
- 'rewrite' => array('slug' => 'articles'), // rewrite the url to make it pretty
- 'menu_position' => 5, // show below Posts but above Media
- 'supports' => array( 'title', 'editor', 'comments', 'revisions', 'author', 'excerpt', 'custom-fields', 'thumbnail' ),
- 'has_archive' => true,
- 'taxonomies' => array('category', 'post_tag'), // just use default categories and tags
- 'show_in_nav_menus' => true // makes this post type available for selection in navigation menus
- );
- register_post_type('tnt_articles', $args);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement