Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ADDING CUSTOM POST TYPE
- add_action('init', 'all_custom_post_types');
- function all_custom_post_types() {
- $types = array(
- // News and Events
- array('the_type' => 'premier-league',
- 'single' => 'Fantasty Premier league',
- 'plural' => 'Fantasty Premier league'),
- // Careers
- array('the_type' => 'champions_league',
- 'single' => 'Champions league',
- 'plural' => 'Champions league'),
- // Faculty
- array('the_type' => 'daily-football',
- 'single' => 'Daily fantasy football',
- 'plural' => 'Daily fantasy football')
- );
- foreach ($types as $type) {
- $the_type = $type['the_type'];
- $single = $type['single'];
- $plural = $type['plural'];
- $labels = array(
- 'name' => _x($plural, 'post type general name'),
- 'singular_name' => _x($single, 'post type singular name'),
- 'all_items' => __( 'All '.$single.' posts'),
- 'add_new' => _x('Add New', $single),
- 'add_new_item' => __('Add New '. $single),
- 'edit_item' => __('Edit '.$single),
- 'new_item' => __('New '.$single),
- 'view_item' => __('View '.$single),
- 'search_items' => __('Search '.$plural),
- 'not_found' => __('No '.$plural.' found'),
- 'not_found_in_trash' => __('No '.$plural.' found in Trash'),
- 'parent_item_colon' => ''
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => true,
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'taxonomies' => array( 'category', 'post_tag' ),
- 'menu_position' => 5,
- 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
- );
- register_post_type($the_type, $args);
- }
- }
Add Comment
Please, Sign In to add comment