Advertisement
rakeshr

register post type and taxonomy code

Sep 18th, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. /* Custom post type Applications code by WPGuru.in */
  2. add_action('init', 'apps_register');
  3.  
  4. function apps_register() {
  5.  
  6.     $labels = array(
  7.         'name' => _x('Applications', 'post type general name'),
  8.         'singular_name' => _x('Application', 'post type singular name'),
  9.         'add_new' => _x('Add New', 'Application'),
  10.         'add_new_item' => __('Add Application'),
  11.         'edit_item' => __('Edit Application'),
  12.         'new_item' => __('New Application'),
  13.         'view_item' => __('View Application'),
  14.         'search_items' => __('Search Application'),
  15.         'not_found' =>  __('Nothing found'),
  16.         'not_found_in_trash' => __('Nothing found in Trash'),
  17.         'parent_item_colon' => ''
  18.     );
  19.  
  20.     $args = array(
  21.         'labels' => $labels,
  22.         'public' => true,
  23.         'publicly_queryable' => true,
  24.         'show_ui' => true,
  25.         'query_var' => true,
  26.         'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
  27.         'rewrite' => true,
  28.         'capability_type' => 'post',
  29.         'hierarchical' => false,
  30.         'menu_position' => null,
  31.         'supports' => array('')
  32.       );
  33.  
  34.     register_post_type( 'apps' , $args );
  35. }
  36.  
  37. function apptypes_init() {
  38.     // create a new taxonomy
  39.     register_taxonomy(
  40.         'apptypes',
  41.         'apps',
  42.         array(
  43.             'hierarchical' => true,
  44.             'label' => __( 'Types' ),
  45.             'sort' => true,
  46.             'args' => array( 'orderby' => 'term_order' ),
  47.             'rewrite' => array( 'slug' => 'types' )
  48.         )
  49.     );
  50. }
  51. add_action( 'init', 'apptypes_init' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement