Advertisement
Guest User

CPT example

a guest
Jan 16th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Post Types
  4.  *
  5.  * This file registers any custom post types
  6.  *
  7.  */
  8.  
  9.  
  10.  
  11.  
  12. /**
  13.  * Create Sponsor Post Type
  14.  *
  15.  */
  16.  
  17. function ssm_register_sponsor_post_type() {
  18.     $labels = array(
  19.         'name' => 'Sponsors',
  20.         'singular_name' => 'Sponsor',
  21.         'add_new' => 'Add New',
  22.         'add_new_item' => 'Add New Sponsor',
  23.         'edit_item' => 'Edit Sponsor',
  24.         'new_item' => 'New Sponsor',
  25.         'view_item' => 'View Sponsor',
  26.         'search_items' => 'Search Sponsors',
  27.         'not_found' =>  'No sponsors found',
  28.         'not_found_in_trash' => 'No sponsors found in trash',
  29.         'parent_item_colon' => '',
  30.         'menu_name' => 'Sponsors'
  31.     );
  32.    
  33.     $args = array(
  34.         'labels' => $labels,
  35.         'public' => true,
  36.         'publicly_queryable' => true,
  37.         'exclude_from_search' => true,
  38.         'show_ui' => true,
  39.         'show_in_menu' => true,
  40.         'query_var' => true,
  41.         'rewrite' => true,
  42.         'capability_type' => 'page',
  43.         'has_archive' => false,
  44.         'hierarchical' => true,
  45.         'supports' => array('title','thumbnail')
  46.     );
  47.  
  48.     register_post_type( 'sponsor', $args );
  49. }
  50. add_action( 'init', 'ssm_register_sponsor_post_type' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement