From 81c6432f4c344ae836b6ed34ba1f09af9478c3d8 Mon Sep 17 00:00:00 2001 From: John Janus Date: Wed, 2 Mar 2016 23:44:38 +0100 Subject: [PATCH] custom type defined, taxonomy added --- main.php | 114 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 91 insertions(+), 23 deletions(-) diff --git a/main.php b/main.php index 5fee237..05bdfbb 100644 --- a/main.php +++ b/main.php @@ -1,31 +1,99 @@ array( - 'name' => __( 'Shows' ), - 'singular_name' => __( 'Show' ), - 'name_admin_bar' => __( 'Show' ) - ), - 'public' => true, - 'has_archive' => true, - 'public' => true, - 'menu_position' => 20 - ) - ); + $singular = __ ( 'Show' ); + $plural = __ ( 'Shows' ); + register_post_type ( 'presale_show', array ( + 'labels' => array ( + 'name' => $plural, + 'singular_name' => $singular, + 'name_admin_bar' => $singular, + 'add_name' => __ ( 'Add New' ), + 'add_new_item' => __ ( 'Add New ' ) . $singular, + 'edit' => __ ( 'Edit' ), + 'edit_item' => __ ( 'Edit ' ) . $singular, + 'new_item' => __ ( 'New ' ) . $singular, + 'view' => __ ( 'View ' ) . $singular, + 'view_item' => __ ( 'View ' ) . $singular, + 'search_term' => __ ( 'Search ' ) . $singular, + 'not_found' => __ ( 'No ' ) . $plural . __ ( ' found' ), + 'not_found_in_trash' => __ ( 'No ' ) . $plural . __ ( ' found in Trash' ) + ), + 'public' => true, + 'publicly_queryable' => true, + 'show_in_nav_menus' => true, + 'show_ui' => true, + 'show_in_menu' => true, + 'show_in_admin_bar' => true, + 'menu_icon' => 'dashicons-tickets-alt', + 'can_export' => true, + 'delete_withuser' => false, + 'hierarchical' => false, + 'has_archive' => true, + 'query_var' => true, + 'capability_type' => 'post', + 'menu_position' => 20, + 'map_meta_cap' => true, + 'rewrite' => array ( + 'slug' => __ ( 'shows' ), + 'with_front' => true, + 'pages' => true, + 'feeds' => true + ), + 'supports' => array ( + 'author', + 'editor', + 'title', + 'custom-fields', + 'thumnails' + ) + ) ); +} + +add_action ( 'init', 'presale_register_taxonomy' ); +function presale_register_taxonomy() { + $plural = __ ( 'Locations' ); + $singular = __ ( 'Location' ); + register_taxonomy ( 'location', 'presale_show', array ( + 'hierarchical' => false, + 'labels' => array ( + 'name' => $plural, + 'singular_name' => $singular, + 'search_items' => __ ( 'Search ' ) . $plural, + 'popular_items' => __ ( 'Popular ' ) . $plural, + 'all_items' => __ ( 'All ' ) . $plural, + 'parent_item' => null, + 'parent_item_column' => null, + 'edit_item' => __ ( 'Edit ' ) . $singular, + 'update_item' => __ ( 'Update ' ) . $singular, + 'add_new_item' => __ ( 'Add New ' ) . $singular, + 'new_item_name' => __ ( 'New ' ) . $singular . __ ( ' Name' ), + 'seperate_items_with_commas' => __ ( 'Seperate ' ) . $plural . __ ( ' with commas' ), + 'add_or_remove_items' => __ ( 'Add or Remove ' ) . $plural, + 'choose_from_most_used' => __ ( 'Choose from most used ' ) . $plural, + 'not_found' => __ ( 'No ' ) . $plural . __ ( ' found' ), + 'menu_name' => $plural + ), + 'show_ui' => true, + 'show_admin_column' => true, + 'update_count_callback' => '_update_post_term_count', + 'query_var' => true, + 'rewrite' => array ( + 'slug' => $singular + ) + ) ); } ?> -- 2.47.0