| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* @Author ParaTheme |
| 5 |
* @Folder Team/Includes |
| 6 |
* @version 3.0.5 |
| 7 |
|
| 8 |
* Copyright: 2015 ParaTheme |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined('ABSPATH')) exit; // if direct access |
| 12 |
|
| 13 |
class team_class_post_types{ |
| 14 |
|
| 15 |
|
| 16 |
public function __construct(){ |
| 17 |
add_action( 'init', array( $this, 'team_posttype_team_member' ), 0 ); |
| 18 |
add_action( 'init', array( $this, 'team_posttype_team' ), 0); |
| 19 |
|
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
public function team_posttype_team_member(){ |
| 24 |
|
| 25 |
if ( post_type_exists( "team_member" ) ) |
| 26 |
return; |
| 27 |
|
| 28 |
$singular = __( 'Team Member', 'team' ); |
| 29 |
$plural = __( 'Team Members', 'team' ); |
| 30 |
|
| 31 |
$team_member_slug = get_option('team_member_slug'); |
| 32 |
|
| 33 |
if(empty($team_member_slug)) {$team_member_slug = 'team_member';} |
| 34 |
|
| 35 |
|
| 36 |
register_post_type( "team_member", |
| 37 |
apply_filters( "register_post_type_team_member", array( |
| 38 |
'labels' => array( |
| 39 |
'name' => $plural, |
| 40 |
'singular_name' => $singular, |
| 41 |
'menu_name' => __( 'Team Member', 'team' ), |
| 42 |
'all_items' => sprintf( __( 'All %s', 'team' ), $plural ), |
| 43 |
'add_new' => __( 'Add New', 'team' ), |
| 44 |
'add_new_item' => sprintf( __( 'Add %s', 'team' ), $singular ), |
| 45 |
'edit' => __( 'Edit', 'team' ), |
| 46 |
'edit_item' => sprintf( __( 'Edit %s', 'team' ), $singular ), |
| 47 |
'new_item' => sprintf( __( 'New %s', 'team' ), $singular ), |
| 48 |
'view' => sprintf( __( 'View %s', 'team' ), $singular ), |
| 49 |
'view_item' => sprintf( __( 'View %s', 'team' ), $singular ), |
| 50 |
'search_items' => sprintf( __( 'Search %s', 'team' ), $plural ), |
| 51 |
'not_found' => sprintf( __( 'No %s found', 'team' ), $plural ), |
| 52 |
'not_found_in_trash' => sprintf( __( 'No %s found in trash', 'team' ), $plural ), |
| 53 |
'parent' => sprintf( __( 'Parent %s', 'team' ), $singular ) |
| 54 |
), |
| 55 |
'description' => sprintf( __( 'This is where you can create and manage %s.', 'team' ), $plural ), |
| 56 |
'public' => true, |
| 57 |
'show_ui' => true, |
| 58 |
'capability_type' => 'post', |
| 59 |
'map_meta_cap' => true, |
| 60 |
'publicly_queryable' => true, |
| 61 |
'exclude_from_search' => false, |
| 62 |
'hierarchical' => false, |
| 63 |
'rewrite' => array( 'slug' => $team_member_slug ), |
| 64 |
'query_var' => true, |
| 65 |
'supports' => array( 'title','editor','thumbnail','custom-fields' ), |
| 66 |
'show_in_nav_menus' => false, |
| 67 |
//'show_in_menu' => 'edit.php?post_type=team', |
| 68 |
'menu_icon' => 'dashicons-admin-users', |
| 69 |
|
| 70 |
) ) |
| 71 |
); |
| 72 |
|
| 73 |
$singular = __( 'Team Group', 'team' ); |
| 74 |
$plural = __( 'Team Groups', 'team' ); |
| 75 |
|
| 76 |
register_taxonomy( "team_group", |
| 77 |
apply_filters( 'register_taxonomy_team_group_object_type', array( 'team_member' ) ), |
| 78 |
apply_filters( 'register_taxonomy_team_group_args', array( |
| 79 |
'hierarchical' => true, |
| 80 |
'show_admin_column' => true, |
| 81 |
'update_count_callback' => '_update_post_term_count', |
| 82 |
'label' => $plural, |
| 83 |
'labels' => array( |
| 84 |
'name' => $plural, |
| 85 |
'singular_name' => $singular, |
| 86 |
'menu_name' => ucwords( $plural ), |
| 87 |
'search_items' => sprintf( __( 'Search %s', 'team' ), $plural ), |
| 88 |
'all_items' => sprintf( __( 'All %s', 'team' ), $plural ), |
| 89 |
'parent_item' => sprintf( __( 'Parent %s', 'team' ), $singular ), |
| 90 |
'parent_item_colon' => sprintf( __( 'Parent %s:', 'team' ), $singular ), |
| 91 |
'edit_item' => sprintf( __( 'Edit %s', 'team' ), $singular ), |
| 92 |
'update_item' => sprintf( __( 'Update %s', 'team' ), $singular ), |
| 93 |
'add_new_item' => sprintf( __( 'Add New %s', 'team' ), $singular ), |
| 94 |
'new_item_name' => sprintf( __( 'New %s Name', 'team' ), $singular ) |
| 95 |
), |
| 96 |
'show_ui' => true, |
| 97 |
'public' => true, |
| 98 |
'rewrite' => array( |
| 99 |
'slug' => 'team_group', // This controls the base slug that will display before each term |
| 100 |
'with_front' => false, // Don't display the category base before "/locations/" |
| 101 |
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/" |
| 102 |
), |
| 103 |
) ) |
| 104 |
); |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
} |
| 109 |
|
| 110 |
public function team_posttype_team(){ |
| 111 |
if ( post_type_exists( "team" ) ) |
| 112 |
return; |
| 113 |
|
| 114 |
$singular = __( 'Team', 'team' ); |
| 115 |
$plural = __( 'Team', 'team' ); |
| 116 |
|
| 117 |
|
| 118 |
register_post_type( "team", |
| 119 |
apply_filters( "register_post_type_team", array( |
| 120 |
'labels' => array( |
| 121 |
'name' => $plural, |
| 122 |
'singular_name' => $singular, |
| 123 |
'menu_name' => __( 'Team', 'team' ), |
| 124 |
'all_items' => sprintf( __( 'All %s', 'team' ), $plural ), |
| 125 |
'add_new' => __( 'Create Team', 'team' ), |
| 126 |
'add_new_item' => sprintf( __( 'Add %s', 'team' ), $singular ), |
| 127 |
'edit' => __( 'Edit', 'team' ), |
| 128 |
'edit_item' => sprintf( __( 'Edit %s', 'team' ), $singular ), |
| 129 |
'new_item' => sprintf( __( 'New %s', 'team' ), $singular ), |
| 130 |
'view' => sprintf( __( 'View %s', 'team' ), $singular ), |
| 131 |
'view_item' => sprintf( __( 'View %s', 'team' ), $singular ), |
| 132 |
'search_items' => sprintf( __( 'Search %s', 'team' ), $plural ), |
| 133 |
'not_found' => sprintf( __( 'No %s found', 'team' ), $plural ), |
| 134 |
'not_found_in_trash' => sprintf( __( 'No %s found in trash', 'team' ), $plural ), |
| 135 |
'parent' => sprintf( __( 'Parent %s', 'team' ), $singular ) |
| 136 |
), |
| 137 |
'description' => sprintf( __( 'This is where you can create and manage %s.', 'team' ), $plural ), |
| 138 |
'public' => true, |
| 139 |
'show_ui' => true, |
| 140 |
'capability_type' => 'post', |
| 141 |
'map_meta_cap' => true, |
| 142 |
'publicly_queryable' => true, |
| 143 |
'exclude_from_search' => false, |
| 144 |
'hierarchical' => false, |
| 145 |
'rewrite' => true, |
| 146 |
'query_var' => true, |
| 147 |
'supports' => array( 'title'), |
| 148 |
'show_in_nav_menus' => false, |
| 149 |
'menu_icon' => 'dashicons-admin-users', |
| 150 |
) ) |
| 151 |
); |
| 152 |
|
| 153 |
|
| 154 |
} |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
} |
| 161 |
|
| 162 |
new team_class_post_types(); |