-
Notifications
You must be signed in to change notification settings - Fork 6
/
functions.php
executable file
·103 lines (81 loc) · 2.28 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
<?php
/**
* Ornea functions and definitions
*
* @package Ornea
*/
if ( ! class_exists( 'Ornea' ) ) :
class Ornea {
private static $instance;
public $version = '1.0';
public $setup;
public $scripts;
public $layout;
public $wc;
protected function __construct() {
$this->include_required_files();
// add_action( 'tgmpa_register', array( $this, 'require_plugins' ) );
$this->setup = new Ornea_Setup();
$this->scripts = new Ornea_Scripts();
$this->layout = new Ornea_Layout();
if ( class_exists( 'WooCommerce' ) ) {
$this->wc = new Ornea_WC();
}
if ( ! get_theme_mod( 'ornea_version', false ) ) {
set_theme_mod( 'ornea_version', $this->version );
}
}
public static function get_instance() {
if ( null == self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
private function include_required_files() {
/**
* If Kirki is not already installed, use the included version
*/
if ( ! class_exists( 'Kirki' ) ) {
require get_template_directory() . '/inc/class-ornea-kirki-installer-section.php';
}
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/class-ornea-kirki.php';
require get_template_directory() . '/inc/customizer.php';
/**
* Include additional theme classes
*/
require get_template_directory() . '/inc/class-ornea-layout.php';
require get_template_directory() . '/inc/class-ornea-scripts.php';
require get_template_directory() . '/inc/class-ornea-setup.php';
require get_template_directory() . '/inc/class-ornea-wc.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* If jetpack is not installed then we need to include its site-logo module
*/
if ( ! function_exists( 'site_logo_init' ) ) {
require get_template_directory() . '/inc/site-logo.php';
}
}
}
endif;
if ( ! function_exists( 'Ornea' ) ) :
function Ornea() {
return Ornea::get_instance();
}
endif;
// Global for backwards compatibility.
$GLOBALS['ornea'] = Ornea();
global $ornea;