-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
127 lines (108 loc) · 2.36 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
* Stop and say "Hello"
*
* @package Hello_From_Tonya\Hello_Genesis_AMP
* @since 1.0.0
* @author Tonya Mork <hellofromtonya>
* @link https://github.com/hellofromtonya/hello-genesis-amp
* @license GPL-2+
*/
namespace Hello_From_Tonya\Hello_Genesis_AMP;
/**
* Get the absolute path to the root directory of the child theme.
*
* @since 1.0.0
*
* @return string returns the directory path.
*/
function get_theme_dir() {
return __DIR__;
}
/**
* Get the URL to the root of the child theme.
*
* @since 1.0.0
*
* @return string returns the URL to the root of the child theme.
*/
function get_theme_url() {
static $url = '';
if ( empty( $url ) ) {
$url = get_stylesheet_directory_uri();
}
return $url;
}
/**
* Get the theme's version.
*
* @since 1.0.0
*
* @return string returns the theme's version.
*/
function get_theme_version() {
static $version = null;
if ( null !== $version ) {
return $version;
}
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$version = filemtime( __DIR__ . '/style.min.css' );
} else {
$version = ( wp_get_theme() )->get( 'Version' );
}
return $version;
}
/**
* Checks if in a debug/dev environment.
*
* @since 1.0.0
*
* @return bool
*/
function is_in_debug() {
return defined( 'WP_DEBUG' ) && WP_DEBUG;
}
/**
* Load the theme's files.
*
* @since 1.0.0
*/
function autoload() {
$filenames = array(
'support/formatting.php',
'support/load-assets.php',
'support/markup.php',
'structure/archive.php',
'structure/comments.php',
'structure/footer.php',
'structure/header.php',
'structure/post.php',
);
foreach ( $filenames as $filename ) {
require_once __DIR__ . '/lib/' . $filename;
}
}
/**
* Sets up the theme.
*
* @since 1.0.0
*
* @return Theme_Setup returns the theme setup instance.
*/
function setup_theme() {
static $theme_setup = null;
if ( null === $theme_setup ) {
require __DIR__ . '/lib/class-theme-setup.php';
$theme_setup = new Theme_Setup( require_once __DIR__ . '/config/theme.php' );
$theme_setup->init();
}
return $theme_setup;
}
// Set up the theme first before loading Genesis.
setup_theme();
// Start up Genesis.
require_once get_template_directory() . '/lib/init.php';
// Load up all the files.
autoload();
// Force full width on the entire site.
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );