forked from roots/sage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
28 lines (25 loc) · 979 Bytes
/
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
<?php
/**
* Do not edit anything in this file unless you know what you're doing
*/
/**
* Here's what's happening with these hooks:
* 1. WordPress detects theme in themes/sage
* 2. When we activate, we tell WordPress that the theme is actually in themes/sage/templates
* 3. When we call get_template_directory() or get_template_directory_uri(), we point it back to themes/sage
*
* We do this so that the Template Hierarchy will look in themes/sage/templates for core WordPress themes
* But functions.php, style.css, and index.php are all still located in themes/sage
*
* themes/sage/index.php also contains some self-correcting code, just in case the template option gets reset
*/
add_filter('template', function ($template) {
return dirname($template);
});
add_action('after_switch_theme', function () {
update_option('template', get_option('template') . '/templates');
});
/**
* Require composer autoloader
*/
require_once __DIR__ . '/vendor/autoload.php';