Repository navigation
Expand file tree
/
Copy pathdocumentation-post-type.php
More file actions
executable file
·58 lines (47 loc) · 1.9 KB
/
Copy pathdocumentation-post-type.php
File metadata and controls
executable file
·58 lines (47 loc) · 1.9 KB
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
<?php
/**
* Documentation Post Type
*
* @package Documentation_Post_Type
* @license GPL-2.0+
*
* @wordpress-plugin
* Plugin Name: Documentation Post Type
* Plugin URI: http://github.com/devinsays/documentation-post-type
* Description: Enables a post type for documentation and related taxonomies.
* Version: 0.1.0
* Author: Devin Price
* Author URI: http://github.com/devinsays/documentation-post-type
* Text Domain: documentation-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';
// Instantiate registration class, so we can add it as a dependency to main plugin class.
$post_type_registrations = new Documentation_Post_Type_Registrations;
// Instantiate main plugin file, so activation callback does not need to be static.
$post_type = new Documentation_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();
/**
* Adds styling to the dashboard for the post type and adds docs 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 Documentation_Post_Type_Admin( $post_type_registrations );
$post_type_admin->init();
}