This repository has been archived by the owner on Feb 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
53 lines (51 loc) · 1.83 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
<?php
/**
* This file links the class file for the Theme and through it, any additional classes.
* Functions should be added to the Theme Class, except for unusual circumstances.
*
* This Theme base code is intended for use in WordPress 5.0 or newer running on PHP 7.0 or newer.
* If that condition doesn't match, the theme will output a warning and WordPress will revert back
* to the default theme.
*/
if ( version_compare( $wp_version, '5.0', '<' ) || version_compare( PHP_VERSION, '7.0', '<' ) ) {
require get_template_directory() . '/utilities/backcompat.php';
} else {
/*
* This lot auto-loads a class or trait just when you need it. You don't need to
* use require, include or anything to get the class/trait files, as long
* as they are stored in the correct folder and use the correct namespaces.
*
* See http://www.php-fig.org/psr/psr-4/ for an explanation of the file structure.
*/
spl_autoload_register(
function ( $class_name ) {
if ( false !== strpos( $class_name, 'TOPLEVELNAMESPACE\THEMENAMESPACE' ) ) {
$classes_dir = realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR;
$class_file = str_replace( 'TOPLEVELNAMESPACE\THEMENAMESPACE\\', DIRECTORY_SEPARATOR, $class_name ) . '.php';
require_once $classes_dir . $class_file;
}
}
);
/**
* Returns the Theme Instance
*
* @return Object Theme Object
*/
if ( ! function_exists( 'PREFIX_theme' ) ) {
function PREFIX_theme() {
return TOPLEVELNAMESPACE\THEMENAMESPACE\Theme::getInstance();
}
}
PREFIX_theme();
PREFIX_theme()->run();
/**
* $content_width is a WordPress requirement
* https://codex.wordpress.org/Content_Width
*
* Customize this value for your website. (Referencing the max. width of the main
* content column at desktop resolution.)
*
* @var int
*/
$content_width = 600;
}