Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Register Custom Post Type
- function ka_custom_post_type() {
- $labels = array(
- 'name' => _x( 'Services', 'Post Type General Name', 'text_domain' ),
- 'singular_name' => _x( 'service', 'Post Type Singular Name', 'text_domain' ),
- 'menu_name' => __( 'Services', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
- 'all_items' => __( 'All Services', 'text_domain' ),
- 'view_item' => __( 'View Service', 'text_domain' ),
- 'add_new_item' => __( 'Add New Service', 'text_domain' ),
- 'add_new' => __( 'Add New', 'text_domain' ),
- 'edit_item' => __( 'Edit Service', 'text_domain' ),
- 'update_item' => __( 'Update Service', 'text_domain' ),
- 'search_items' => __( 'Search Services', 'text_domain' ),
- 'not_found' => __( 'No service(s) Found', 'text_domain' ),
- 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
- );
- $args = array(
- 'label' => __( 'Service', 'text_domain' ),
- 'description' => __( 'Services', 'text_domain' ),
- 'labels' => $labels,
- 'supports' => array( 'title','thumbnail', 'revisions', ),
- 'taxonomies' => array('service_taxonomy' ),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'show_in_nav_menus' => true,
- 'show_in_admin_bar' => true,
- 'menu_position' => 5,
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'capability_type' => 'page',
- 'rewrite' => true
- );
- register_post_type( 'service', $args );
- }
- // Hook into the 'init' action
- add_action( 'init', 'ka_custom_post_type', 0 );
- // Register Custom Taxonomy
- function ka_service_taxonomy() {
- $labels = array(
- 'name' => _x( 'Services', 'Taxonomy General Name', 'ka' ),
- 'singular_name' => _x( 'Service', 'Taxonomy Singular Name', 'ka' ),
- 'menu_name' => __( 'Service Categories', 'ka' ),
- 'all_items' => __( 'All Items', 'ka' ),
- 'parent_item' => __( 'Parent Item', 'ka' ),
- 'parent_item_colon' => __( 'Parent Item:', 'ka' ),
- 'new_item_name' => __( 'New Item Name', 'ka' ),
- 'add_new_item' => __( 'Add New Category', 'ka' ),
- 'edit_item' => __( 'Edit Item', 'ka' ),
- 'update_item' => __( 'Update Item', 'ka' ),
- 'separate_items_with_commas' => __( 'Separate items with commas', 'ka' ),
- 'search_items' => __( 'Search Items', 'ka' ),
- 'add_or_remove_items' => __( 'Add or remove items', 'ka' ),
- 'choose_from_most_used' => __( 'Choose from the most used items', 'ka' ),
- 'not_found' => __( 'Not Found', 'ka' ),
- );
- $rewrite = array(
- 'slug' => 'service',
- 'with_front' => true,
- 'hierarchical' => false,
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => true,
- 'public' => true,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'show_in_nav_menus' => true,
- 'show_tagcloud' => true,
- 'rewrite' => $rewrite,
- );
- register_taxonomy( 'service_taxonomy', array( 'service' ), $args );
- }
- // Hook into the 'init' action
- add_action( 'init', 'ka_service_taxonomy', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement