Advertisement
imranmodel32

custom post type & custom texonomy

Jul 11th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.97 KB | None | 0 0
  1. /*---------------------------code for custom post type------------------*/
  2.  
  3.  
  4. function my_custom_post_product() {
  5.     $labels = array(
  6.         'name'               => _( 'advisor' ),
  7.         'singular_name'      => _( 'advisor' ),
  8.         'add_new'            => _( 'Add New' ),
  9.         'add_new_item'       => __( 'Add New advisor' ),
  10.         'edit_item'          => __( 'Edit advisor' ),
  11.         'new_item'           => __( 'New advisor' ),
  12.         'all_items'          => __( 'All advisor' ),
  13.         'view_item'          => __( 'View advisor' ),
  14.         'search_items'       => __( 'Search advisor' ),
  15.         'not_found'          => __( 'No advisor found' ),
  16.         'not_found_in_trash' => __( 'No advisor found in the Trash' ),
  17.         'parent_item_colon'  => '',
  18.         'menu_name'          => 'advisor'
  19.     );
  20.     $args = array(
  21.         'labels'        => $labels,
  22.         'description'   => 'Our advisors are here',
  23.         'public'        => true,
  24.         'menu_position' => 5,
  25.         'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments','custom-fields' ),
  26.         'has_archive'   => true,
  27.     );
  28.     register_post_type( 'advisor', $args );
  29. }
  30. add_action( 'init', 'my_custom_post_product' );
  31.  
  32.  
  33.  
  34. /*---------------------------code for custom texnomoy------------------*/
  35.  
  36.  
  37. // Register Custom Taxonomy
  38. function rx_lawyer_category() {
  39.  
  40.     $labels = array(
  41.         'name'                       => _x( 'Lawyer Category', 'Taxonomy General Name', 'rx_theme' ),
  42.         'singular_name'              => _x( 'Lawyer Category', 'Taxonomy Singular Name', 'rx_theme' ),
  43.         'menu_name'                  => __( 'Lawyer Category', 'rx_theme' ),
  44.         'all_items'                  => __( 'All Items', 'rx_theme' ),
  45.         'parent_item'                => __( 'Parent Lawyer Category', 'rx_theme' ),
  46.         'parent_item_colon'          => __( 'Parent Lawyer Category:', 'rx_theme' ),
  47.         'new_item_name'              => __( 'New Lawyer Category Name', 'rx_theme' ),
  48.         'add_new_item'               => __( 'Add New Lawyer Category', 'rx_theme' ),
  49.         'edit_item'                  => __( 'Edit Lawyer Category', 'rx_theme' ),
  50.         'update_item'                => __( 'Update Lawyer Category', 'rx_theme' ),
  51.         'separate_items_with_commas' => __( 'Separate Lawyer Categorys with commas', 'rx_theme' ),
  52.         'search_items'               => __( 'Search Lawyer Category', 'rx_theme' ),
  53.         'add_or_remove_items'        => __( 'Add or remove Lawyer Category', 'rx_theme' ),
  54.         'choose_from_most_used'      => __( 'Choose from the most used Lawyer Category', 'rx_theme' ),
  55.         'not_found'                  => __( 'Not Found', 'rx_theme' ),
  56.     );
  57.     $args = array(
  58.         'labels'                     => $labels,
  59.         'hierarchical'               => true,
  60.         'public'                     => true,
  61.         'show_ui'                    => true,
  62.         'show_admin_column'          => true,
  63.         'show_in_nav_menus'          => true,
  64.         'show_tagcloud'              => false,
  65.         'query_var'                  => true,
  66.     );
  67.     register_taxonomy( 'lawyer_category', array( 'rx_lawyer' ), $args );
  68.  
  69. }
  70.  
  71. // Hook into the 'init' action
  72. add_action( 'init', 'rx_lawyer_category', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement