From fb19145d423668b3ce5d17ca27a5e15c84ab8f34 Mon Sep 17 00:00:00 2001 From: QWp6t Date: Mon, 7 Nov 2016 00:57:41 -0800 Subject: [PATCH] Theme activation updates 'stylesheet' option instead of 'template' --- functions.php | 17 ++++++++--------- index.php | 5 +---- src/helpers.php | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/functions.php b/functions.php index 13f151e..969a2aa 100644 --- a/functions.php +++ b/functions.php @@ -20,22 +20,21 @@ if (file_exists($composer = __DIR__ . '/vendor/autoload.php')) { * 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 + * get_template_directory() -> /srv/www/example.com/current/web/app/themes/sage + * get_stylesheet_directory() -> /srv/www/example.com/current/web/app/themes/sage + * locate_template() + * ├── STYLESHEETPATH -> /srv/www/example.com/current/web/app/themes/sage + * └── TEMPLATEPATH -> /srv/www/example.com/current/web/app/themes/sage/templates */ -add_filter('stylesheet', function ($stylesheet) { +add_filter('template', function ($stylesheet) { return dirname($stylesheet); }); add_action('after_switch_theme', function () { - $stylesheet = get_option('stylesheet'); + $stylesheet = get_option('template'); if (basename($stylesheet) !== 'templates') { - update_option('stylesheet', $stylesheet . '/templates'); + update_option('template', $stylesheet . '/templates'); } }); -add_action('customize_render_section', function ($section) { - if ($section->type === 'themes') { - $section->title = wp_get_theme(basename(__DIR__))->display('Name'); - } -}, 10, 2); /** * Sage includes diff --git a/index.php b/index.php index 452d62d..04501c1 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,3 @@