-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
57 lines (42 loc) · 1.21 KB
/
functions.php
File metadata and controls
57 lines (42 loc) · 1.21 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
<?php
/**
* CGU functions and definitions
*/
// Useful global constants
define( 'CGU_VERSION', '0.1.0' );
define( 'CGU_URL', get_stylesheet_directory_uri() );
define( 'CGU_TEMPLATE_URL', get_template_directory_uri() );
define( 'CGU_PATH', get_template_directory() . '/' );
define( 'CGU_INC', CGU_PATH . 'includes/' );
// Include compartmentalized functions
require_once CGU_INC . 'functions/core.php';
// Include Post types
include CGU_INC . 'post-types/program.php';
include CGU_INC . 'post-types/school.php';
include CGU_INC . 'post-types/study-area.php';
include CGU_INC . 'post-types/people.php';
// Include Taxonomies
include CGU_INC . 'taxos/school.php';
include CGU_INC . 'taxos/study-area.php';
include CGU_INC . 'taxos/people-type.php';
// Include lib classes
// Run the setup functions
CGU\Core\setup();
/**
* Get post by slug
*
* @param string Post Slug.
* @return post object
*/
function get_post_by_slug( $slug, $type='post' ){
$posts = get_posts( array(
'name' => $slug,
'posts_per_page' => 1,
'post_type' => $type,
'post_status' => 'publish'
));
if( ! $posts ) {
return false;
}
return $posts[0];
}