-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
61 lines (49 loc) · 1.32 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
<?php
/**
* Child theme functions
* User: P.D. Rittenhouse
*/
//Include Composer Autoload
require_once( __DIR__ . '/vendor/autoload.php' );
//Initialize Timber
$timber = new Timber\Timber();
/**
* Timber Error handling
*/
if ( ! class_exists( 'Timber' ) ) {
add_action( 'admin_notices', function() {
echo '<div class="error"><p>Timber not activated. Make sure you activate the plugin in <a href="' . esc_url( admin_url( 'plugins.php#timber' ) ) . '">' . esc_url( admin_url( 'plugins.php' ) ) . '</a></p></div>';
});
add_filter('template_include', function( $template ) {
return get_stylesheet_directory() . '/static/no-timber.html';
});
return;
}
/**
* Sets the directories (inside your theme) to find .twig files
*/
Timber::$locations = array(
__DIR__.'/src/templates/',
__DIR__.'/src/patternlab/source/_patterns/',
__DIR__.'/dist/wp/img/'
);
/**
* By default, Timber does NOT autoescape values. Want to enable Twig's autoescape?
* No prob! Just set this value to true
*/
Timber::$autoescape = false;
/**
* Include settings from /src/functions
*/
$dream_includes = array(
"config.php",
"styles.php",
"scripts.php",
"paths.php",
"vars.php",
"data.php",
"filters.php"
);
foreach($dream_includes as $inc){
include_once(get_stylesheet_directory() . "/src/functions/$inc");
}