Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'init', 'films_register' );
- function films_register() {
- register_post_type( 'films',
- array(
- 'labels' => array(
- 'name' => 'Films',
- 'singular_name' => 'Film',
- 'add_new' => 'Add New',
- 'add_new_item' => 'Add New Film',
- 'edit' => 'Edit',
- 'edit_item' => 'Edit Film',
- 'new_item' => 'New Film',
- 'view' => 'View',
- 'view_item' => 'View Film',
- 'search_items' => 'Search Film',
- 'not_found' => 'No Movies found',
- 'not_found_in_trash' => 'No Movies found in Trash',
- 'parent' => 'Parent Film'
- ),
- 'public' => true,
- //'publicly_queryable' => true,
- //'capability_type' => 'post',
- //'query_var' => true,
- 'menu_position' => 15,
- 'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields', 'excerpt', 'trackbacks' ),
- 'show_ui' => true,
- 'menu_icon' => plugins_url( 'images/image.png', __FILE__ ),
- 'has_archive' => true,
- 'rewrite' => array( 'slug' => 'films' ),
- )
- );
- }
- add_action('admin_init', 'flush_rewrite_rules');
- function create_films_taxonomies()
- {
- //Add new taxonomy, Genre
- $labels = array(
- 'name' => _x( 'Genres', 'taxonomy general name' ),
- 'singular_name' => _x( 'Genre', 'taxonomy singular name' ),
- 'search_items' => __( 'Search 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' ),
- 'menu_name' => __( 'Genres' )
- );
- $args = array(
- 'public' => true,
- 'hierarchical' => true,
- 'labels' => $labels,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'films/genre' )
- );
- register_taxonomy( 'genre', array( 'films' ), $args );
- // Add new taxonomy, Topics
- $labels = array(
- 'name' => _x( 'Topic', 'taxonomy general name' ),
- 'singular_name' => _x( 'Topics', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Topic' ),
- 'all_items' => __( 'All Topics' ),
- 'parent_item' => __( 'Parent Topic' ),
- 'parent_item_colon' => __( 'Parent Topic:' ),
- 'edit_item' => __( 'Edit Topic' ),
- 'update_item' => __( 'Update Topic' ),
- 'add_new_item' => __( 'Add New Topic' ),
- 'new_item_name' => __( 'New Topic Name' ),
- 'menu_name' => __( 'Topics' )
- );
- $args = array(
- 'public' => true,
- 'labels' => $labels,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'films/topic' ),
- 'hierarchical' => false
- );
- register_taxonomy( 'topics', array( 'films' ), $args );
- // Add new taxonomy, Collections
- $labels = array(
- 'name' => _x( 'Collections', 'taxonomy general name' ),
- 'singular_name' => _x( 'Collection', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Collections' ),
- 'all_items' => __( 'All Collections' ),
- 'parent_item' => __( 'Parent Collection' ),
- 'parent_item_colon' => __( 'Parent Collection:' ),
- 'edit_item' => __( 'Edit Collection' ),
- 'update_item' => __( 'Update Collection' ),
- 'add_new_item' => __( 'Add New Collection' ),
- 'new_item_name' => __( 'New Collection Name' ),
- 'menu_name' => __( 'Collections' )
- );
- $args = array(
- 'public' => true,
- 'hierarchical' => false,
- 'labels' => $labels,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'collection' )
- );
- register_taxonomy( 'collection', array( 'films' ), $args );
- }
- add_action( 'init', 'create_films_taxonomies', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement