-
Notifications
You must be signed in to change notification settings - Fork 39
/
team-post-type.php
executable file
·64 lines (51 loc) · 2 KB
/
team-post-type.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Team Post Type
*
* @package Team_Post_Type
* @license GPL-2.0+
*
* @wordpress-plugin
* Plugin Name: Team Post Type
* Plugin URI: http://github.com/devinsays/team-post-type
* Description: Enables a team post type, taxonomy and metaboxes.
* Version: 0.1.0
* Author: Devin Price
* Author URI: http://github.com/devinsays/team-post-type
* Text Domain: team-post-type
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Required files for registering the post type and taxonomies.
require plugin_dir_path( __FILE__ ) . 'includes/class-post-type.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-post-type-registrations.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-post-type-metaboxes.php';
// Instantiate registration class, so we can add it as a dependency to main plugin class.
$post_type_registrations = new Team_Post_Type_Registrations;
// Instantiate main plugin file, so activation callback does not need to be static.
$post_type = new Team_Post_Type( $post_type_registrations );
// Register callback that is fired when the plugin is activated.
register_activation_hook( __FILE__, array( $post_type, 'activate' ) );
// Initialize registrations for post-activation requests.
$post_type_registrations->init();
// Initialize metaboxes
$post_type_metaboxes = new Team_Post_Type_Metaboxes;
$post_type_metaboxes->init();
/**
* Adds styling to the dashboard for the post type and adds team posts
* to the "At a Glance" metabox.
*/
if ( is_admin() ) {
// Loads for users viewing the WordPress dashboard
if ( ! class_exists( 'Dashboard_Glancer' ) ) {
require plugin_dir_path( __FILE__ ) . 'includes/class-dashboard-glancer.php'; // WP 3.8
}
require plugin_dir_path( __FILE__ ) . 'includes/class-post-type-admin.php';
$post_type_admin = new Team_Post_Type_Admin( $post_type_registrations );
$post_type_admin->init();
}