Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('init', 'register_projects_post_type' );
- add_action( 'init', 'create_projects_taxonomy', 0 );
- function register_projects_post_type(){
- register_post_type( 'sp_project', array(
- 'labels' => array(
- 'name' => __( 'Projects' ),
- 'singular_name' => __( 'Project' ),
- 'add_new' => __( 'Add Project' ),
- 'add_new_item' => __( 'Add Project' ),
- 'edit' => __( 'Edit' ),
- 'edit_item' => __( 'Edit Project' ),
- 'new_item' => __( 'New Project' ),
- 'view' => __( 'View project' ),
- 'view_item' => __( 'View project' ),
- 'search_items' => __( 'Search Projects' ),
- 'not_found' => __( 'No project found' ),
- 'parent_item_colon' => __('Client'),
- 'parent' => __('Client')
- ),
- 'hierarchical' => true,
- 'public' => true,
- 'menu_position' => 7,
- 'has_archive' => true,
- 'query_var' => true,
- 'rewrite' => array('slug' => 'projects', 'with_front' => false),
- 'supports' => array( 'title', 'editor','thumbnail', 'custom-fields', 'excerpt', 'page-attributes', 'revisions'),
- 'description' => "Use this to add a new project."
- )
- );
- }
- function create_projects_taxonomy(){
- $labels = array(
- 'name' => _x( 'Types', 'taxonomy general name' ),
- 'singular_name' => _x( 'Type', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Types' ),
- 'all_items' => __( 'All Types' ),
- 'parent_item' => null,
- 'parent_item_colon' => null,
- 'edit_item' => __( 'Edit Type' ),
- 'update_item' => __( 'Update Type' ),
- 'add_new_item' => __( 'Add New Type' ),
- 'new_item_name' => __( 'New Type Name' ),
- 'separate_items_with_commas' => __( 'Separate types with commas' ),
- 'choose_from_most_used' => __('Choose from common types'),
- 'menu_name' => __( 'Project types' ),
- 'parent' => __('Client'),
- 'parent_item_colon' => __('Client')
- );
- register_taxonomy('clients','sp_project', array(
- 'hierarchical' => true,
- 'labels' => $labels,
- 'show_ui' => true,
- 'query_var' => true,
- 'update_count_callback' => '_update_post_term_count',
- 'rewrite' => false /*array( 'slug' => 'projects' )*/
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement