pixedelic

pix_post-types_hacked.php

Oct 3rd, 2011
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.18 KB | None | 0 0
  1. <?php
  2. add_action('init', 'register_portfolio');
  3.  
  4. function register_portfolio() {
  5.     $args = array(
  6.         'labels' => array(
  7.             'name' => __( 'Portfolio' ),
  8.             'singular_name' => __( 'Portfolio' ),
  9.             'add_new' => _x('Add new', 'portfolio'),
  10.             'add_new_item' => __('Add a new item'),
  11.             'edit_item' => __('Edit item'),
  12.             'new_item' => __('New item'),
  13.             'view_item' => __('View item'),
  14.           ),
  15.         'capability_type' => 'page',
  16.         'has_archive' => true,
  17.         'hierarchical' => false,
  18.         'menu_position' => 20,
  19.         'public' => true,
  20.         'rewrite' => false,
  21.         'singular_label' => __('Portfolio'),
  22.         'show_ui' => true,
  23.         'supports' => array(
  24.             'title',
  25.             'thumbnail',
  26.             'editor',
  27.             'excerpt',
  28.             'trackbacks',
  29.             'custom-fields',
  30.             'comments',
  31.             'revisions')
  32.     );
  33.  
  34.     register_post_type( 'portfolio' , $args );
  35. }
  36.  
  37. add_action( 'init', 'create_portfolio_taxonomies', 0 );
  38.  
  39. //create two taxonomies, genres and writers for the post type "book"
  40. function create_portfolio_taxonomies()
  41. {
  42.   // Add new taxonomy, make it hierarchical (like categories)
  43.   $labels = array(
  44.     'name' => _x( 'Galleries', 'taxonomy general name' ),
  45.     'singular_name' => _x( 'Gallery', 'taxonomy singular name' ),
  46.     'search_items' =>  __( 'Search Gallery' ),
  47.     'all_items' => __( 'All Galleries' ),
  48.     'parent_item' => __( 'Parent Gallery' ),
  49.     'parent_item_colon' => __( 'Parent Gallery:' ),
  50.     'edit_item' => __( 'Edit Gallery' ),
  51.     'update_item' => __( 'Update Gallery' ),
  52.     'add_new_item' => __( 'Add New Gallery' ),
  53.     'new_item_name' => __( 'New Gallery Name' ),
  54.     'menu_name' => __( 'Galleries' ),
  55.   );    
  56.  
  57.   register_taxonomy('gallery',array('portfolio'), array(
  58.     'hierarchical' => true,
  59.     'labels' => $labels,
  60.     'show_ui' => true,
  61.     'query_var' => true,
  62.     'rewrite' => array( 'slug' => 'gallery' ),
  63.   ));
  64.  
  65.   // Add new taxonomy, NOT hierarchical (like tags)
  66.   $labels = array(
  67.     'name' => _x( 'Image tags', 'taxonomy general name' ),
  68.     'singular_name' => _x( 'Image tag', 'taxonomy singular name' ),
  69.     'search_items' =>  __( 'Search Image tags' ),
  70.     'popular_items' => __( 'Popular Image tags' ),
  71.     'all_items' => __( 'All Image tags' ),
  72.     'parent_item' => null,
  73.     'parent_item_colon' => null,
  74.     'edit_item' => __( 'Edit Image tag' ),
  75.     'update_item' => __( 'Update Image tag' ),
  76.     'add_new_item' => __( 'Add New Image tag' ),
  77.     'new_item_name' => __( 'New Image tag Name' ),
  78.     'separate_items_with_commas' => __( 'Separate image tags with commas. They will be used for filtering portfolio items' ),
  79.     'add_or_remove_items' => __( 'Add or remove image tags' ),
  80.     'choose_from_most_used' => __( 'Choose from the most used image tags' ),
  81.     'menu_name' => __( 'Image tags' ),
  82.   );
  83.  
  84.   register_taxonomy('image_tag','portfolio',array(
  85.     'hierarchical' => false,
  86.     'labels' => $labels,
  87.     'show_ui' => true,
  88.     'query_var' => true,
  89.     'rewrite' => array( 'slug' => 'image_tag' ),
  90.   ));
  91.  
  92.   // Add new taxonomy, NOT hierarchical (like tags)
  93.   $labels = array(
  94.     'name' => _x( 'Relationships', 'taxonomy general name' ),
  95.     'singular_name' => _x( 'Relationships', 'taxonomy singular name' ),
  96.     'search_items' =>  __( 'Search Relationships' ),
  97.     'popular_items' => __( 'Popular Relationships' ),
  98.     'all_items' => __( 'All Relationships' ),
  99.     'parent_item' => null,
  100.     'parent_item_colon' => null,
  101.     'edit_item' => __( 'Edit Relationship' ),
  102.     'update_item' => __( 'Update Relationship' ),
  103.     'add_new_item' => __( 'Add New Relationship' ),
  104.     'new_item_name' => __( 'New Relationship Name' ),
  105.     'separate_items_with_commas' => __( 'Separate relationship with commas. They will be used for related items box' ),
  106.     'add_or_remove_items' => __( 'Add or remove relationships' ),
  107.     'choose_from_most_used' => __( 'Choose from the most used relationships' ),
  108.     'menu_name' => __( 'Relationships' ),
  109.   );
  110.  
  111.   register_taxonomy('relationship','portfolio',array(
  112.     'hierarchical' => false,
  113.     'labels' => $labels,
  114.     'show_ui' => true,
  115.     'query_var' => true,
  116.     'rewrite' => array( 'slug' => 'relationship' ),
  117.   ));
  118. }
  119.  
  120. /*=========================================================================================*/
  121.  
  122. ?>
  123.  
Add Comment
Please, Sign In to add comment