-
Notifications
You must be signed in to change notification settings - Fork 8
/
functions.php
59 lines (44 loc) · 1.48 KB
/
functions.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
<?php
/**
* The Maera class autoloader.
* Finds the path to a class that we're requiring and includes the file.
*/
function maera_autoload_classes( $class_name ) {
if ( class_exists( $class_name ) ) {
return;
}
$class_path = get_template_directory() . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'class-' . strtolower( str_replace( '_', '-', $class_name ) ) . '.php';
if ( file_exists( $class_path ) ) {
include $class_path;
}
}
// Run the autoloader
spl_autoload_register( 'maera_autoload_classes' );
require_once( get_template_directory() . '/includes/template-hierarchy.php' );
require_once( get_template_directory() . '/includes/utils.php' );
require_once( get_template_directory() . '/includes/widgets.php' );
require_once( get_template_directory() . '/includes/class-maera-timber.php' );
/**
* Dummy function to prevent fatal errors with the Tonesque library
* Only used when Jetpack is not installed.
*/
if ( ! function_exists( 'jetpack_require_lib' ) && ! is_admin() ) {
function jetpack_require_lib() {}
}
function Maera() {
return Maera::get_instance();
}
// Global
$GLOBALS['maera'] = maera();
global $maera;
// Load our Maera_EDD class if EDD is installed
if ( class_exists( 'Easy_Digital_Downloads' ) ) {
Maera_EDD::get_instance();
}
function maera_replace_title_if_front_page_is_posts( $title ) {
if ( 'Archives' == $title ) {
$title = 'Blog';
}
return $title;
}
add_filter( 'get_the_archive_title', 'maera_replace_title_if_front_page_is_posts' );