Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // register the movie custom post type
- add_action('init', 'cptui_register_my_cpt_movie');
- function cptui_register_my_cpt_movie() {
- register_post_type('movie', array(
- 'label' => 'Movies',
- 'description' => 'Movie listings',
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'capability_type' => 'post',
- 'map_meta_cap' => true,
- 'hierarchical' => false,
- 'rewrite' => array('slug' => 'movie', 'with_front' => true),
- 'query_var' => true,
- 'has_archive' => true,
- 'exclude_from_search' => true,
- 'publicly_queryable' => true,
- 'menu_position' => 5,
- 'supports' => array('title','excerpt','comments','revisions','thumbnail'),
- 'taxonomies' => array('actors','director','genre'),
- 'labels' => array (
- 'name' => 'Movies',
- 'singular_name' => 'Movie',
- 'menu_name' => 'Movies',
- 'add_new' => 'Add Movie',
- 'add_new_item' => 'Add New Movie',
- 'edit' => 'Edit',
- 'edit_item' => 'Edit Movie',
- 'new_item' => 'New Movie',
- 'view' => 'View Movie',
- 'view_item' => 'View Movie',
- 'search_items' => 'Search Movies',
- 'not_found' => 'No Movies Found',
- 'not_found_in_trash' => 'No Movies found in Trash',
- 'parent' => 'Parent Movie',
- )
- ) );
- }
- // Register the Actor Taxonomy
- add_action('init', 'cptui_register_my_taxes_actors');
- function cptui_register_my_taxes_actors() {
- register_taxonomy( 'actors',array (
- 0 => 'movie',
- ),
- array( 'hierarchical' => false,
- 'label' => 'Starring',
- 'show_ui' => true,
- 'query_var' => true,
- 'show_admin_column' => true,
- 'rewrite' => array( 'slug' => 'actor' ),
- 'labels' => array (
- 'search_items' => 'Actor',
- 'popular_items' => 'Most Used Actors',
- 'all_items' => 'All Actors',
- 'parent_item' => 'Parent Actor',
- 'parent_item_colon' => 'Parent Actor:',
- 'edit_item' => 'Edit Actor',
- 'update_item' => 'Update Actor',
- 'add_new_item' => 'Add New Actor',
- 'new_item_name' => 'New Actor Name',
- 'separate_items_with_commas' => 'Separate actors with commas)',
- 'add_or_remove_items' => 'Add or remove actors',
- 'choose_from_most_used' => 'Choose from the most used actors',
- )
- ) );
- }
- // Register the Directory Taxonomy
- add_action('init', 'cptui_register_my_taxes_director');
- function cptui_register_my_taxes_director() {
- register_taxonomy( 'director',array (
- 0 => 'movie',
- ),
- array( 'hierarchical' => false,
- 'label' => 'Directed by',
- 'show_ui' => true,
- 'query_var' => true,
- 'show_admin_column' => true,
- 'rewrite' => array( 'slug' => 'director' ),
- 'labels' => array (
- 'search_items' => 'Director',
- 'popular_items' => 'Most Used Directors',
- 'all_items' => 'All Directors',
- 'parent_item' => 'Parent Director',
- 'parent_item_colon' => 'Parent Director:',
- 'edit_item' => 'Edit Director',
- 'update_item' => 'Update Director',
- 'add_new_item' => 'Add New Director',
- 'new_item_name' => 'New Director Name',
- 'separate_items_with_commas' => 'Separate directors with commas',
- 'add_or_remove_items' => 'Add or remove directors',
- 'choose_from_most_used' => 'Choose from the most used directors',
- )
- ) );
- }
- // Register the Genre Taxonomy
- add_action('init', 'cptui_register_my_taxes_genre');
- function cptui_register_my_taxes_genre() {
- register_taxonomy( 'genre',array (
- 0 => 'movie',
- ),
- array( 'hierarchical' => true,
- 'label' => 'Genres',
- 'show_ui' => true,
- 'query_var' => true,
- 'show_admin_column' => true,
- 'rewrite' => array( 'slug' => 'genre' ),
- 'labels' => array (
- 'search_items' => 'Genre',
- 'popular_items' => 'Popular Genres',
- 'all_items' => 'All Genres',
- 'parent_item' => 'Parent Genre',
- 'parent_item_colon' => 'Parent Genre:',
- 'edit_item' => 'Edit Genre',
- 'update_item' => 'Update Genre',
- 'add_new_item' => 'Add New Genre',
- 'new_item_name' => 'New Genre Name',
- 'separate_items_with_commas' => 'Separate genres with commas',
- 'add_or_remove_items' => 'Add or remove genres',
- 'choose_from_most_used' => 'Choose from the most used genres',
- )
- ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement