-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
42 lines (38 loc) · 966 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
40
41
42
<?php
/**
* Bootstrap file for Kunoichi theme.
*
* @package hakama
*/
load_theme_textdomain( 'hakama', __DIR__ . '/languages' );
// Load autoloader
$autoloader = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $autoloader ) ) {
require_once $autoloader;
$base_dir = __DIR__ . '/app/Kunoichi/Hakama';
foreach ( [ 'Widgets' ] as $dir ) {
$path = $base_dir . '/' . $dir;
if ( ! is_dir( $path ) ) {
continue;
}
foreach ( scandir( $path ) as $file ) {
if ( preg_match( '#^([^._].*)\.php$#u', $file, $matches ) ) {
$class_name = 'Kunoichi\\Hakama\\' . $dir . '\\' . $matches[1];
if ( class_exists( $class_name ) ) {
}
}
}
}
}
// Load all subroutines.
foreach ( [ 'hooks', 'functions' ] as $dir ) {
$dir = get_template_directory() . '/' . $dir;
if ( is_dir( $dir ) ) {
foreach ( scandir( $dir ) as $file ) {
if ( ! preg_match( '#^[^._].*\.php$#u', $file ) ) {
continue;
}
include $dir . '/' . $file;
}
}
}