-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpitchfork-docs.php
More file actions
81 lines (63 loc) · 2.46 KB
/
Copy pathpitchfork-docs.php
File metadata and controls
81 lines (63 loc) · 2.46 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Plugin Name: Pitchfork Docs
* Plugin URI: http://github.com/ASU-Engineering/Pitchfork-Docs
* Description: Really simple documentation style page template. Documents come with and autocompleted table-of-contents and a separate taxonomy structure foe easy document grouping. Compatible with the <a href="https://github.com/ASU-KE/UDS-WordPress-Theme">UDS-WordPress theme</a> from ASU KE.
* Author: Steve Ryan, ASU Engineering
* Author URI: https://engineering.asu.edu
* Text Domain: pitchfork-docs
* Domain Path: /languages
* Version: 1.3
*
* @package Pitchfork_Docs
*
* GitHub Plugin URI: http://github.com/ASU-Engineering/Pitchfork-Docs
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Variable for root directory of this plugin.
define( 'PITCHFORK_DOCS_BASE_PATH', plugin_dir_path( __FILE__ ) );
// Composer vendor autoload
if ( file_exists( PITCHFORK_DOCS_BASE_PATH . 'vendor/autoload.php' ) ) {
require_once PITCHFORK_DOCS_BASE_PATH . 'vendor/autoload.php';
}
// Function: Activate.
// Function: Deactivate.
// Function: Execute plugin.
// Custom Post Type and Taxonomy Info
require_once PITCHFORK_DOCS_BASE_PATH . '/inc/cpt-document.php';
require_once PITCHFORK_DOCS_BASE_PATH . '/inc/tax-document-category.php';
// Enqueue scripts.
require_once PITCHFORK_DOCS_BASE_PATH . '/inc/enqueue-scripts.php';
// Gamajo Template Loader Script.
// Checks for the correct template files within the theme, uses included files as a fallback.
require_once PITCHFORK_DOCS_BASE_PATH . '/inc/template-loader/class-pitchfork-docs-template-loader.php';
/**
* Custom routing for included templates for the established CPT.
* Enabled by the use of the template loader class above.
*
* @param mixed $template
* @return void
*/
function get_pitchfork_docs_templates( $template ) {
global $post;
if ( 'pitchfork-docs' === $post->post_type ) {
$docs_template_loader = new Pitchfork_Docs_Template_Loader();
if ( is_singular() ) {
$docs_template_loader
->get_template_part( 'document' );
} elseif ( is_tax( 'pitchfork-docs-category' ) ) {
$docs_template_loader
->get_template_part( 'document-category' );
} elseif ( is_archive() ) {
$docs_template_loader
->get_template_part( 'archive-document' );
}
} else {
// Return the normal template file if the request should be ignored.
return $template;
}
}
add_filter( 'template_include', 'get_pitchfork_docs_templates' );