Advertisement
bowenac

Untitled

Oct 9th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.28 KB | None | 0 0
  1.     // Register Custom Post Type
  2.     function ka_custom_post_type() {
  3.      
  4.         $labels = array(
  5.             'name'                => _x( 'Services', 'Post Type General Name', 'text_domain' ),
  6.             'singular_name'       => _x( 'service', 'Post Type Singular Name', 'text_domain' ),
  7.             'menu_name'           => __( 'Services', 'text_domain' ),
  8.             'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),
  9.             'all_items'           => __( 'All Services', 'text_domain' ),
  10.             'view_item'           => __( 'View Service', 'text_domain' ),
  11.             'add_new_item'        => __( 'Add New Service', 'text_domain' ),
  12.             'add_new'             => __( 'Add New', 'text_domain' ),
  13.             'edit_item'           => __( 'Edit Service', 'text_domain' ),
  14.             'update_item'         => __( 'Update Service', 'text_domain' ),
  15.             'search_items'        => __( 'Search Services', 'text_domain' ),
  16.             'not_found'           => __( 'No service(s) Found', 'text_domain' ),
  17.             'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),
  18.         );
  19.         $args = array(
  20.             'label'               => __( 'Service', 'text_domain' ),
  21.             'description'         => __( 'Services', 'text_domain' ),
  22.             'labels'              => $labels,
  23.             'supports'            => array( 'title','thumbnail', 'revisions',  ),
  24.             'taxonomies'          => array('service_taxonomy' ),
  25.             'hierarchical'        => false,
  26.             'public'              => true,
  27.             'show_ui'             => true,
  28.             'show_in_menu'        => true,
  29.             'show_in_nav_menus'   => true,
  30.             'show_in_admin_bar'   => true,
  31.             'menu_position'       => 5,
  32.             'can_export'          => true,
  33.             'has_archive'         => true,
  34.             'exclude_from_search' => false,
  35.             'publicly_queryable'  => true,
  36.             'capability_type'     => 'page',
  37.                     'rewrite'             => true
  38.         );
  39.         register_post_type( 'service', $args );
  40.      
  41.     }  
  42.     // Hook into the 'init' action
  43.     add_action( 'init', 'ka_custom_post_type', 0 );
  44.      
  45.     // Register Custom Taxonomy
  46.     function ka_service_taxonomy() {
  47.      
  48.         $labels = array(
  49.             'name'                       => _x( 'Services', 'Taxonomy General Name', 'ka' ),
  50.             'singular_name'              => _x( 'Service', 'Taxonomy Singular Name', 'ka' ),
  51.             'menu_name'                  => __( 'Service Categories', 'ka' ),
  52.             'all_items'                  => __( 'All Items', 'ka' ),
  53.             'parent_item'                => __( 'Parent Item', 'ka' ),
  54.             'parent_item_colon'          => __( 'Parent Item:', 'ka' ),
  55.             'new_item_name'              => __( 'New Item Name', 'ka' ),
  56.             'add_new_item'               => __( 'Add New Category', 'ka' ),
  57.             'edit_item'                  => __( 'Edit Item', 'ka' ),
  58.             'update_item'                => __( 'Update Item', 'ka' ),
  59.             'separate_items_with_commas' => __( 'Separate items with commas', 'ka' ),
  60.             'search_items'               => __( 'Search Items', 'ka' ),
  61.             'add_or_remove_items'        => __( 'Add or remove items', 'ka' ),
  62.             'choose_from_most_used'      => __( 'Choose from the most used items', 'ka' ),
  63.             'not_found'                  => __( 'Not Found', 'ka' ),
  64.         );
  65.         $rewrite = array(
  66.             'slug'                       => 'service',
  67.             'with_front'                 => true,
  68.             'hierarchical'               => false,
  69.         );
  70.         $args = array(
  71.             'labels'                     => $labels,
  72.             'hierarchical'               => true,
  73.             'public'                     => true,
  74.             'show_ui'                    => true,
  75.             'show_admin_column'          => true,
  76.             'show_in_nav_menus'          => true,
  77.             'show_tagcloud'              => true,
  78.             'rewrite'                    => $rewrite,
  79.         );
  80.         register_taxonomy( 'service_taxonomy', array( 'service' ), $args );
  81.      
  82.     }
  83.     // Hook into the 'init' action
  84.     add_action( 'init', 'ka_service_taxonomy', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement