-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
39 lines (30 loc) · 951 Bytes
/
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
<?php
define('LOAD_ON_INIT', 1);
function autoload_classes($name) {
$class_name = strtolower(
implode(
'-',
preg_split('/(?=[A-Z])/', $name, -1, PREG_SPLIT_NO_EMPTY)
)
);
$class_path = get_template_directory() . '/includes/class.'
. $class_name . '.php';
if(file_exists($class_path)) require_once $class_path;
}
spl_autoload_register('autoload_classes');
function autoload_lib_classes($name) {
$lib_class_name = get_template_directory() . '/includes/class.'
. strtolower($name) . '.php';
if(file_exists($lib_class_name)) require_once($lib_class_name);
}
spl_autoload_register('autoload_lib_classes');
if(function_exists('__autoload')) {
spl_autoload_register('__autoload');
}
function include_additional_files() {
$template_url = get_template_directory();
if(is_admin()) {
new CustomMetaboxes();
}
}
add_action('init', 'include_additional_files', LOAD_ON_INIT);