-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathfunctions.php
executable file
·112 lines (80 loc) · 3.13 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
if( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if( !class_exists( 'BFG' ) ) {
#[AllowDynamicProperties]
final class BFG {
private static $instance;
private static $classes = array(
'custom-page-template',
);
/**
* BFG Constructor.
*/
public function __construct() {
$this->define_constants();
$this->includes();
}
public static function get_instance() {
if( self::$instance === null )
self::$instance = new self();
return self::$instance;
}
/**
* Child theme constants.
*/
private function define_constants() {
define( 'CHILD_THEME_TEXT_DOMAIN', 'bfg' );
$use_production_assets = wp_get_environment_type() === 'production';
define( 'BFG_PRODUCTION', $use_production_assets );
// Never show errors on production
// https://stackoverflow.com/questions/9242903/php-hide-all-errors
if( BFG_PRODUCTION && !defined('WP_DEBUG') ) {
error_reporting(0);
ini_set('display_errors', 0);
}
}
/**
* Include required core files used in admin and on the frontend.
*/
private function includes() {
// Initialize Genesis
require_once get_template_directory() . '/lib/init.php';
// Composer
require_once CHILD_DIR . '/vendor/autoload.php';
// Developer Tools
require_once CHILD_DIR . '/includes/developer-tools.php';
// Genesis
require_once CHILD_DIR . '/includes/genesis.php'; // Customizations to Genesis-specific functions
// Admin
require_once CHILD_DIR . '/includes/admin/admin-functions.php'; // Customization to admin functionality
require_once CHILD_DIR . '/includes/admin/admin-views.php'; // Customizations to the admin area display
require_once CHILD_DIR . '/includes/admin/admin-branding.php'; // Admin view customizations that specifically involve branding
require_once CHILD_DIR . '/includes/admin/admin-options.php'; // For adding/editing theme options to Genesis
// Structure (corresponds to Genesis's lib/structure)
require_once CHILD_DIR . '/includes/structure/comments.php';
require_once CHILD_DIR . '/includes/structure/footer.php';
require_once CHILD_DIR . '/includes/structure/gravity-forms.php';
require_once CHILD_DIR . '/includes/structure/head.php';
require_once CHILD_DIR . '/includes/structure/header.php';
require_once CHILD_DIR . '/includes/structure/icons.php';
require_once CHILD_DIR . '/includes/structure/images.php';
require_once CHILD_DIR . '/includes/structure/layout.php';
require_once CHILD_DIR . '/includes/structure/loops.php';
require_once CHILD_DIR . '/includes/structure/menu.php';
require_once CHILD_DIR . '/includes/structure/post.php';
require_once CHILD_DIR . '/includes/structure/search.php';
require_once CHILD_DIR . '/includes/structure/sidebar.php';
// Shame
require_once CHILD_DIR . '/includes/shame.php'; // For new code snippets that haven't been sorted and commented yet
require_once CHILD_DIR . '/includes/classes/abstracts/template.php';
// Classes
foreach( self::$classes as $key )
$this->{$key} = require_once CHILD_DIR . '/includes/classes/' . $key . '.php';
}
}
}
function BFG() {
return BFG::get_instance();
}
// Global for backwards compatibility.
$GLOBALS['bfg'] = BFG();