Advertisement
Guest User

Custom Taxonomy Not working

a guest
Sep 7th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. /* Hooks */
  2.  
  3. add_action( 'init', 'nd_brooklin_posttype' );
  4. add_action( 'init', 'nd_brooklin_taxonomy' );
  5. add_action( 'init', 'nd_brooklin_metaboxes');
  6.  
  7. /* Functions */
  8.  
  9. function nd_brooklin_posttype(){
  10. //Set up custom post type variables.
  11. $labels = array(
  12. 'name' => _x('Brooklin Models', 'post type general name'),
  13. 'singular_name' => _x('Model', 'post type singular name'),
  14. 'add_new' => _x('Add New', 'Model'),
  15. 'add_new_item' => __('Add New Model'),
  16. 'edit_item' => __('Edit Model'),
  17. 'new_item' => __('New Model'),
  18. 'view_item' => __('View Model'),
  19. 'search_items' => __('Search Models'),
  20. 'not_found' => __('Nothing found'),
  21. 'not_found_in_trash' => __('Nothing found in Trash'),
  22. 'parent_item_colon' => ''
  23. );
  24. $args = array(
  25. 'labels' => $labels,
  26. 'public' => true,
  27. 'publicly_queryable' => true,
  28. 'show_ui' => true,
  29. 'query_var' => true,
  30. 'rewrite' => true,
  31. 'capability_type' => 'page',
  32. 'hierarchical' => false,
  33. 'menu_position' => 20,
  34. 'supports' => array(
  35. 'title',
  36. 'editor',
  37. 'thumbnail'),
  38. 'rewrite' => array( 'slug' => 'model' ),
  39. );
  40. //Register the newsletter post type.
  41. register_post_type( 'nd_brooklin' , $args );
  42. flush_rewrite_rules();
  43. }
  44.  
  45. function nd_brooklin_taxonomy(){
  46. register_taxonomy(
  47. 'nd_brooklin_tax',
  48. 'nd_brooklin',
  49. array(
  50. 'hierarchical' => true,
  51. 'label' => 'Ranges',
  52. 'query_var' => true,
  53. 'rewrite' => true,
  54. 'rewrite' => array( 'slug' => 'ranges' )
  55. )
  56. );
  57. if( function_exists('add_term_ordering_support') ) add_term_ordering_support ('nd_brooklin_tax');
  58. }
  59.  
  60. function nd_brooklin_metaboxes(){
  61. $pluginDir = WP_PLUGIN_DIR . '/19d_brooklinProducts';
  62. if(!class_exists('WPAlchemy_MetaBox'))include_once $pluginDir . '/WPAlchemy/MetaBox.php';
  63. if (is_admin()) wp_enqueue_style('custom_meta_css', WP_PLUGIN_URL . '/19d_brooklinProducts' . '/box-styles.css');
  64.  
  65. $nd_brooklin_metabox = new WPAlchemy_MetaBox(
  66. array(
  67. 'id' => '_nd_brooklin',
  68. 'title' => 'Model Preferences',
  69. 'template' => $pluginDir . '/box-styles/nd_brooklin.php',
  70. 'types' => array('nd_brooklin'),
  71. 'context' => 'normal',
  72. 'priority' => 'high',
  73. 'autosave' => TRUE,
  74. 'mode' => WPALCHEMY_MODE_EXTRACT
  75. )
  76. );
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement