Created
July 20, 2017 19:25
-
-
Save thedotmack/0b471f79b05689d8e52b898d50ea477a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_membership_support() { | |
$labels = array( | |
'name' => _x( 'DTS Premium', 'post type general name', 'sage' ), | |
'singular_name' => _x( 'Premium Post', 'post type singular name', 'sage' ), | |
'menu_name' => _x( 'Premium Posts', 'admin menu', 'sage' ), | |
'name_admin_bar' => _x( 'Premium Post', 'add new on admin bar', 'sage' ), | |
'add_new' => _x( 'Add New', 'product', 'sage' ), | |
'add_new_item' => __( 'Add New Premium Post', 'sage' ), | |
'new_item' => __( 'New Premium Post', 'sage' ), | |
'edit_item' => __( 'Edit Premium Post', 'sage' ), | |
'view_item' => __( 'View Premium Post', 'sage' ), | |
'all_items' => __( 'All Premium Posts', 'sage' ), | |
'search_items' => __( 'Search Premium Posts', 'sage' ), | |
'parent_item_colon' => __( 'Parent Premium Posts:', 'sage' ), | |
'not_found' => __( 'No premium posts found.', 'sage' ), | |
'not_found_in_trash' => __( 'No premium posts found in Trash.', 'sage' ) | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'label' => 'Premium Posts', | |
'has_archive' => true, | |
'menu_icon' => 'dashicons-lock', | |
'capability_type' => 'post', | |
'supports' => array( | |
'title', | |
'editor', | |
'author', | |
'thumbnail', | |
'excerpt', | |
'trackbacks', | |
'custom-fields', | |
'comments', | |
'revisions' | |
), | |
'rewrite' => array('slug' => 'premium') | |
); | |
register_post_type( 'premium', $args ); | |
register_taxonomy_for_object_type( 'premium-category', 'premium' ); | |
} | |
add_action( 'init', 'add_membership_support' ); | |
// Register Custom Taxonomy | |
function premium_category() { | |
$labels = array( | |
'name' => _x( 'Premium Categories', 'Taxonomy General Name', 'text_domain' ), | |
'singular_name' => _x( 'Premium Category', 'Taxonomy Singular Name', 'text_domain' ), | |
'menu_name' => __( 'Categories', 'text_domain' ), | |
'all_items' => __( 'All Items', 'text_domain' ), | |
'parent_item' => __( 'Parent Item', 'text_domain' ), | |
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ), | |
'new_item_name' => __( 'New Item Name', 'text_domain' ), | |
'add_new_item' => __( 'Add New Item', 'text_domain' ), | |
'edit_item' => __( 'Edit Item', 'text_domain' ), | |
'update_item' => __( 'Update Item', 'text_domain' ), | |
'view_item' => __( 'View Item', 'text_domain' ), | |
'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ), | |
'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ), | |
'choose_from_most_used' => __( 'Choose from the most used', 'text_domain' ), | |
'popular_items' => __( 'Popular Items', 'text_domain' ), | |
'search_items' => __( 'Search Items', 'text_domain' ), | |
'not_found' => __( 'Not Found', 'text_domain' ), | |
'no_terms' => __( 'No items', 'text_domain' ), | |
'items_list' => __( 'Items list', 'text_domain' ), | |
'items_list_navigation' => __( 'Items list navigation', 'text_domain' ), | |
); | |
$args = array( | |
'labels' => $labels, | |
'hierarchical' => true, | |
'public' => true, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'show_in_nav_menus' => true, | |
'show_tagcloud' => true, | |
); | |
register_taxonomy( 'premium-category', array( 'premium' ), $args ); | |
} | |
add_action( 'init', 'premium_category', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment