-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
49 lines (42 loc) · 1.49 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
<?php
/**
* WordPress functions
*/
// Define enviroment as production if WP_ENV is not set
if ( !defined('WP_ENV') || ('development' !== WP_ENV && 'staging' !== WP_ENV) ) {
define( 'WP_ENV', 'production' );
}
//* Require composer depedencies
if ( file_exists( get_stylesheet_directory() . '/vendor/autoload.php' ) ) {
require_once get_stylesheet_directory() . '/vendor/autoload.php';
}
new Timber\Timber();
/**
* Includes
*
* The $includes array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
*
* Please note that missing files will produce a fatal error.
*/
$includes = [];
$includes[] = 'lib/variables.php'; // Variables
$includes[] = 'lib/helpers/debug.php'; // Helpers
foreach ($includes as $file) {
$filepath = locate_template($file);
if ( ! $filepath ) {
trigger_error(sprintf(__('Error locating %s for inclusion'), $file), E_USER_ERROR);
}
require_once $filepath;
}
unset($file, $filepath);
// * Register post types
add_action( 'init', [ '\\luisms\\TimberSage\\PostType\\Registrator', 'init' ] );
// * Register taxonomies
add_action( 'init', [ '\\luisms\\TimberSage\\Taxonomy\\Registrator', 'init' ] );
// * Base template
add_filter( 'template_include', [ '\\luisms\\TimberSage\\Wrapper', 'wrap' ], 109 );
// * Enqueue Scripts
add_action( 'wp_enqueue_scripts', [ '\\luisms\\TimberSage\\Assets', 'enqueue' ], 100 );
// * Setup Theme
add_action( 'after_setup_theme', [ '\\luisms\\TimberSage\\Setup', 'run' ] );