Advertisement
Guest User

3 Custom post types

a guest
Oct 2nd, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.71 KB | None | 0 0
  1. // Register Custom Post Type
  2. function practice_area_cpt() {
  3.  
  4.     $labels = array(
  5.         'name'                => 'Practice Areas',
  6.         'singular_name'       => 'Practice Area',
  7.         'menu_name'           => 'Practice Area',
  8.         'parent_item_colon'   => 'Parent Practice Area:',
  9.         'all_items'           => 'All Practice Areas',
  10.         'view_item'           => 'View Practice Area',
  11.         'add_new_item'        => 'Add New Practice Area',
  12.         'add_new'             => 'New Practice',
  13.         'edit_item'           => 'Edit Practice Area',
  14.         'update_item'         => 'Update Practice Area',
  15.         'search_items'        => 'Search Practice Areas',
  16.         'not_found'           => 'No Practice Areas found',
  17.         'not_found_in_trash'  => 'No Practice Areas found in Trash',
  18.     );
  19.     $rewrite = array(
  20.         'slug'                => 'practice-area',
  21.         'with_front'          => true,
  22.         'pages'               => true,
  23.         'feeds'               => true,
  24.     );
  25.     $args = array(
  26.         'label'               => 'practice-area',
  27.         'description'         => 'Practice Area pages',
  28.         'labels'              => $labels,
  29.         'supports'            => array( 'title', 'thumbnail' ),
  30.         'hierarchical'        => true,
  31.         'public'              => true,
  32.         'show_ui'             => true,
  33.         'show_in_menu'        => false,
  34.         'show_in_nav_menus'   => true,
  35.         'show_in_admin_bar'   => false,
  36.         'menu_position'       => 5,
  37.         'menu_icon'           => '',
  38.         'can_export'          => true,
  39.         'has_archive'         => true,
  40.         'exclude_from_search' => false,
  41.         'publicly_queryable'  => true,
  42.         'rewrite'             => $rewrite,
  43.         'capability_type'     => 'page',
  44.     );
  45.     register_post_type( 'practice-area', $args );
  46.  
  47. }
  48.  
  49. // Hook into the 'init' action
  50. add_action( 'init', 'practice_area_cpt' );
  51.  
  52.  
  53. // Register Custom Post Type
  54. function about_cpt() {
  55.  
  56.     $labels = array(
  57.         'name'                => 'About Us',
  58.         'singular_name'       => 'About',
  59.         'menu_name'           => 'About',
  60.         'parent_item_colon'   => 'Parent About:',
  61.         'all_items'           => 'All About',
  62.         'view_item'           => 'View About',
  63.         'add_new_item'        => 'Add New About',
  64.         'add_new'             => 'New About',
  65.         'edit_item'           => 'Edit About',
  66.         'update_item'         => 'Update About',
  67.         'search_items'        => 'Search About page',
  68.         'not_found'           => 'No About page found',
  69.         'not_found_in_trash'  => 'No about pages found in Trash',
  70.     );
  71.     $rewrite = array(
  72.         'slug'                => 'about',
  73.         'with_front'          => true,
  74.     );
  75.     $args = array(
  76.         'label'               => 'about',
  77.         'description'         => 'About page',
  78.         'labels'              => $labels,
  79.         'supports'            => array( 'title', 'editor', 'thumbnail' ),
  80.         'hierarchical'        => false,
  81.         'public'              => true,
  82.         'show_ui'             => true,
  83.         'show_in_menu'        => false,
  84.         'show_in_nav_menus'   => true,
  85.         'show_in_admin_bar'   => false,
  86.         'menu_position'       => 5,
  87.         'menu_icon'           => '',
  88.         'can_export'          => true,
  89.         'has_archive'         => false,
  90.         'exclude_from_search' => false,
  91.         'publicly_queryable'  => true,
  92.         'rewrite'             => $rewrite,
  93.         'capability_type'     => 'page',
  94.     );
  95.     register_post_type( 'about', $args );
  96.  
  97. }
  98.  
  99. // Hook into the 'init' action
  100. add_action( 'init', 'about_cpt' );
  101.  
  102. function register_cpt_attorney() {
  103.  
  104.     $labels = array(
  105.         'name' => _x( 'Attorneys', 'attorney' ),
  106.         'singular_name' => _x( 'Attorney', 'attorney' ),
  107.         'add_new' => _x( 'Add New Attorneys', 'attorney' ),
  108.         'add_new_item' => _x( 'Add New Attorney', 'attorney' ),
  109.         'edit_item' => _x( 'Edit Attorney', 'attorney' ),
  110.         'new_item' => _x( 'New Attorney', 'attorney' ),
  111.         'view_item' => _x( 'View Attorney', 'attorney' ),
  112.         'search_items' => _x( 'Search Attorneys', 'attorney' ),
  113.         'not_found' => _x( 'No attorneys found', 'attorney' ),
  114.         'not_found_in_trash' => _x( 'No attorneys found in Trash', 'attorney' ),
  115.         'parent_item_colon' => _x( 'Parent Attorney:', 'attorney' ),
  116.         'menu_name' => _x( 'Attorneys', 'attorney' ),
  117.     );
  118.  
  119.     $args = array(
  120.         'labels' => $labels,
  121.         'hierarchical' => false,
  122.         'description' => 'Your Attorney page(s).',
  123.         'supports' => array( 'thumbnail' ),
  124.        
  125.         'public' => true,
  126.         'show_ui' => true,
  127.         'show_in_menu' => false,
  128.         'menu_position' => 5,
  129.         'show_in_nav_menus' => true,
  130.         'publicly_queryable' => true,
  131.         'exclude_from_search' => false,
  132.         'has_archive' => true,
  133.         'query_var' => true,
  134.         'can_export' => true,
  135.         'rewrite' => true,
  136.         'capability_type' => 'post'
  137.  
  138.     );
  139.     register_post_type( 'attorney', $args );
  140. }
  141.  
  142. add_action( 'init', 'register_cpt_attorney' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement