From 9eaffa3a2d4df462dd8020a10551334208bd32a3 Mon Sep 17 00:00:00 2001 From: QWp6t Date: Fri, 18 Dec 2015 16:41:37 -0800 Subject: [PATCH] Restructure theme, use autoloader --- .travis.yml | 5 +- app/admin.php | 15 ++ app/filters.php | 55 +++++++ app/helpers.php | 77 ++++++++++ app/lib/Sage/Asset.php | 35 +++++ app/lib/Sage/Assets/IManifest.php | 26 ++++ app/lib/Sage/Assets/JsonManifest.php | 29 ++++ app/lib/Sage/Template.php | 151 ++++++++++++++++++++ app/lib/Sage/Template/IWrapper.php | 27 ++++ app/lib/Sage/Template/Wrapper.php | 48 +++++++ app/setup.php | 96 +++++++++++++ composer.json | 15 +- composer.lock | 119 +++++++++++++++ functions.php | 44 +++--- gulpfile.js | 2 +- index.php | 18 +-- lib/assets.php | 58 -------- lib/customizer.php | 21 --- lib/extras.php | 33 ----- lib/setup.php | 106 -------------- lib/titles.php | 24 ---- lib/wrapper.php | 64 --------- package.json | 2 +- page.php | 4 - ruleset.xml | 5 - single.php | 1 - style.css | 2 +- template-custom.php | 10 -- 404.php => templates/404.php | 2 +- templates/index.php | 14 ++ base.php => templates/layouts/base.php | 19 +-- templates/page-header.php | 5 - templates/page.php | 4 + templates/{ => partials}/comments.php | 0 templates/{ => partials}/content-page.php | 0 templates/{ => partials}/content-search.php | 2 +- templates/{ => partials}/content-single.php | 4 +- templates/{ => partials}/content.php | 2 +- templates/{ => partials}/entry-meta.php | 0 templates/{ => partials}/footer.php | 0 templates/{ => partials}/head.php | 0 templates/{ => partials}/header.php | 0 templates/partials/page-header.php | 3 + templates/{ => partials}/sidebar.php | 0 search.php => templates/search.php | 4 +- templates/single.php | 1 + templates/template-custom.php | 10 ++ 47 files changed, 770 insertions(+), 392 deletions(-) create mode 100644 app/admin.php create mode 100644 app/filters.php create mode 100644 app/helpers.php create mode 100644 app/lib/Sage/Asset.php create mode 100644 app/lib/Sage/Assets/IManifest.php create mode 100644 app/lib/Sage/Assets/JsonManifest.php create mode 100644 app/lib/Sage/Template.php create mode 100644 app/lib/Sage/Template/IWrapper.php create mode 100644 app/lib/Sage/Template/Wrapper.php create mode 100644 app/setup.php create mode 100644 composer.lock delete mode 100644 lib/assets.php delete mode 100644 lib/customizer.php delete mode 100644 lib/extras.php delete mode 100644 lib/setup.php delete mode 100644 lib/titles.php delete mode 100644 lib/wrapper.php delete mode 100644 page.php delete mode 100644 single.php delete mode 100644 template-custom.php rename 404.php => templates/404.php (73%) create mode 100644 templates/index.php rename base.php => templates/layouts/base.php (69%) delete mode 100644 templates/page-header.php create mode 100644 templates/page.php rename templates/{ => partials}/comments.php (100%) rename templates/{ => partials}/content-page.php (100%) rename templates/{ => partials}/content-search.php (71%) rename templates/{ => partials}/content-single.php (76%) rename templates/{ => partials}/content.php (80%) rename templates/{ => partials}/entry-meta.php (100%) rename templates/{ => partials}/footer.php (100%) rename templates/{ => partials}/head.php (100%) rename templates/{ => partials}/header.php (100%) create mode 100644 templates/partials/page-header.php rename templates/{ => partials}/sidebar.php (100%) rename search.php => templates/search.php (70%) create mode 100644 templates/single.php create mode 100644 templates/template-custom.php diff --git a/.travis.yml b/.travis.yml index fa38f3635f..ac066b908c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,9 +23,12 @@ install: - composer self-update && composer --version - export PATH="$HOME/.composer/vendor/bin:$PATH" - composer global require squizlabs/php_codesniffer + - composer global require phpmd/phpmd + - composer install -o script: - npm run build - npm run jshint - npm run jscs - - phpcs --standard=ruleset.xml --extensions=php -n -s . + - phpcs --standard=ruleset.xml --extensions=php --ignore=node_modules,bower_components,vendor -n -s . + - phpmd app text cleancode,codesize,controversial,design,naming,unusedcode diff --git a/app/admin.php b/app/admin.php new file mode 100644 index 0000000000..74fa2c480f --- /dev/null +++ b/app/admin.php @@ -0,0 +1,15 @@ +get_setting('blogname')->transport = 'postMessage'; +}); + +/** + * Customizer JS + */ +add_action('customize_preview_init', function () { + wp_enqueue_script('sage/customizer', asset_path('scripts/customizer.js'), ['customize-preview'], null, true); +}); diff --git a/app/filters.php b/app/filters.php new file mode 100644 index 0000000000..a631da64db --- /dev/null +++ b/app/filters.php @@ -0,0 +1,55 @@ + classes + */ +add_filter('body_class', function (array $classes) { + // Add page slug if it doesn't exist + if (is_single() || is_page() && !is_front_page()) { + if (!in_array(basename(get_permalink()), $classes)) { + $classes[] = basename(get_permalink()); + } + } + + // Add class if sidebar is active + if (display_sidebar()) { + $classes[] = 'sidebar-primary'; + } + + return $classes; +}); + +/** + * Clean up the_excerpt() + */ +add_filter('excerpt_more', function () { + return ' … ' . __('Continued', 'sage') . ''; +}); + + +/** + * Use Wrapper by default + */ +add_filter('template_include', function ($main) { + if (!is_string($main) || !(string) $main) { + return $main; + } + $main = basename($main, '.php'); + return Template::wrap(new Wrapper($main, 'layouts/base.php'))->locate(); +}, 109); diff --git a/app/helpers.php b/app/helpers.php new file mode 100644 index 0000000000..395744a9b6 --- /dev/null +++ b/app/helpers.php @@ -0,0 +1,77 @@ +locate()) { + /** @noinspection PhpIncludeInspection */ + include $file; + } +} + +/** + * @param array $context + */ +function template_sidebar($context = []) { + template_part('sidebar', $context); +} + +/** + * @param $template + * @param array $context + */ +function template_part($template, $context = []) { + if ($file = (new Template($template, $context))->locate()) { + /** @noinspection PhpIncludeInspection */ + include $file; + } +} + +/** + * @param $filename + * @return string + */ +function asset_path($filename) { + static $manifest; + isset($manifest) || $manifest = new JsonManifest(get_template_directory() . '/' . Asset::$dist . '/assets.json'); + return (string) new Asset($filename, $manifest); +} + +/** + * Determine whether to show the sidebar + * @return bool + */ +function display_sidebar() { + static $display; + isset($display) || $display = apply_filters('sage/display_sidebar', true); + return $display; +} + +/** + * Page titles + * @return string + */ +function title() { + if (is_home()) { + if ($home = get_option('page_for_posts', true)) { + return get_the_title($home); + } + return __('Latest Posts', 'sage'); + } + if (is_archive()) { + return get_the_archive_title(); + } + if (is_search()) { + return sprintf(__('Search Results for %s', 'sage'), get_search_query()); + } + if (is_404()) { + return __('Not Found', 'sage'); + } + return get_the_title(); +} diff --git a/app/lib/Sage/Asset.php b/app/lib/Sage/Asset.php new file mode 100644 index 0000000000..fd47a7bfa1 --- /dev/null +++ b/app/lib/Sage/Asset.php @@ -0,0 +1,35 @@ +manifest = $manifest; + $this->asset = basename($file); + $this->dir = dirname($file) != '.' ? dirname($file) : ''; + } + + public function __toString() { + return $this->getUri(); + } + + public function getUri() { + $file = self::$dist . '/' . $this->dir . '/' . ($this->manifest ? $this->manifest->get($this->asset) : $this->asset); + return get_template_directory_uri() . $file; + } +} diff --git a/app/lib/Sage/Assets/IManifest.php b/app/lib/Sage/Assets/IManifest.php new file mode 100644 index 0000000000..62b5134261 --- /dev/null +++ b/app/lib/Sage/Assets/IManifest.php @@ -0,0 +1,26 @@ +manifest = file_exists($manifestPath) ? json_decode(file_get_contents($manifestPath), true) : []; + } + + /** @inheritdoc */ + public function get($file) { + return isset($this->manifest[$file]) ? $this->manifest[$file] : $file; + } + + /** @inheritdoc */ + public function getAll() { + return $this->manifest; + } +} diff --git a/app/lib/Sage/Template.php b/app/lib/Sage/Template.php new file mode 100644 index 0000000000..3655e76e44 --- /dev/null +++ b/app/lib/Sage/Template.php @@ -0,0 +1,151 @@ +getSlug()] = $wrapper; + return new static($wrapper->getWrappers(), $context); + } + + /** + * @param string $slug + * @param array $context + * @return static + */ + public static function unwrap($slug = '', $context = []) { + if (!$slug) { + // If no slug is specified, we grab the most recently wrapped item + end(self::$wrappers); + $slug = key(self::$wrappers); + } + return new static(self::$wrappers[$slug]->getTemplate(), $context); + } + + /** + * Converts a delimeted template file into an array of parts + * + * Example: + * Template::getConvertedTemplateParts('content-single-audio.php'); + * => ['content-single-audio.php', 'content-single.php', 'content.php'] + * + * The returned value can then be passed to WordPress's locate_template. + * + * @param string $template + * @param string $delimeter + * @return array + */ + public static function convertParts($template, $delimeter = '-') { + $templateParts = explode($delimeter, str_replace('.php', '', (string) $template)); + $templates[] = array_shift($templateParts); + foreach ($templateParts as $i => $templatePart) { + $templates[] = $templates[$i] . $delimeter . $templatePart; + } + return array_reverse($templates); + } + + /** + * Template constructor + * @param string|string[] $template + * @param array $context + */ + public function __construct($template, array $context = []) { + $this->set($template); + $this->context = $context; + } + + /** + * @return string HTML + * @see get + */ + public function __toString() { + return $this->get(); + } + + /** + * Echoes the output HTML + * @see get + */ + public function render() { + echo $this->get(); + } + + /** + * @return string HTML + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + public function get() { + /** @noinspection PhpUnusedLocalVariableInspection $context is passed to the included template */ + $context = $this->context; + extract($this->context); + ob_start(); + if ($template = $this->locate()) { + /** @noinspection PhpIncludeInspection */ + include $template; + } + $this->html = ob_get_clean() ?: ''; + return $this->html; + } + + /** + * @param string[]|string $template + */ + public function set($template) { + if (is_array($template)) { + $this->templates = self::format($template); + return; + } + if (!is_string($template) || !(string) $template) { + return; + } + // At this point, we assume it's something like `content-single.php` or `content-single-audio.php` + $this->templates = self::format(self::convertParts($template)); + } + + /** + * Ensures that each template in $this->templates is appended with `.php` + * @param $templates + * @return array + */ + protected static function format($templates) { + return array_map(function ($template) { + if (substr($template, -4, 4) === '.php') { + return $template; + } + return $template . '.php'; + }, $templates); + } + + /** + * @param string $templateDir Specify a template directory relative to your theme directory; e.g., `templates/`, `templates/partials/`, `woocommerce/` + * @return string Filename + */ + public function locate($templateDir = '') { + $templates = array_map(function ($template) use ($templateDir) { + return ($templateDir ?: self::$root) . $template; + }, $this->templates); + $template = locate_template($templates); + return apply_filters('sage/locate_template', $template, $templates) ?: $template; + } +} diff --git a/app/lib/Sage/Template/IWrapper.php b/app/lib/Sage/Template/IWrapper.php new file mode 100644 index 0000000000..d785988788 --- /dev/null +++ b/app/lib/Sage/Template/IWrapper.php @@ -0,0 +1,27 @@ +slug = sanitize_title(basename($base, '.php')); + $this->wrappers = [$base]; + $this->template = $templateSlug; + $str = substr($base, 0, -4); + array_unshift($this->wrappers, sprintf($str . '-%s.php', $templateSlug)); + } + + /** {@inheritdoc} */ + public function getWrappers() { + $this->wrappers = apply_filters('sage/wrap_' . $this->slug, $this->wrappers) ?: $this->wrappers; + return $this->wrappers; + } + + /** {@inheritdoc} */ + public function getSlug() { + return $this->slug; + } + + /** {@inheritdoc} */ + public function getTemplate() + { + return $this->template; + } +} diff --git a/app/setup.php b/app/setup.php new file mode 100644 index 0000000000..1127939e41 --- /dev/null +++ b/app/setup.php @@ -0,0 +1,96 @@ + __('Primary Navigation', 'sage') + ]); + + /** + * Enable post thumbnails + * @link http://codex.wordpress.org/Post_Thumbnails + * @link http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size + * @link http://codex.wordpress.org/Function_Reference/add_image_size + */ + add_theme_support('post-thumbnails'); + + /** + * Enable post formats + * @link http://codex.wordpress.org/Post_Formats + */ + add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']); + + /** + * Enable HTML5 markup support + * @link http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5 + */ + add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); + + /** + * Use main stylesheet for visual editor + * @see /assets/styles/layouts/_tinymce.scss + */ + add_editor_style(asset_path('styles/main.css')); +}); + +/** + * Register sidebars + */ +add_action('widgets_init', function () { + $config = function ($name, $id = '') { + return [ + 'name' => __($name, 'sage'), + 'id' => 'sidebar-' . $id ?: sanitize_title($name), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

' + ]; + }; + + register_sidebar($config('Primary')); + register_sidebar($config('Footer')); +}); + +/** + * Theme assets + */ +add_action('wp_enqueue_scripts', function () { + wp_enqueue_style('sage/css', asset_path('styles/main.css'), false, null); + + if (is_single() && comments_open() && get_option('thread_comments')) { + wp_enqueue_script('comment-reply'); + } + + wp_enqueue_script('sage/js', asset_path('scripts/main.js'), ['jquery'], null, true); +}, 100); diff --git a/composer.json b/composer.json index d9e6d58c7b..8afb68b185 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,19 @@ "issues": "https://github.com/roots/sage/issues", "forum": "https://discourse.roots.io/" }, + "autoload": { + "psr-4": { + "Roots\\Sage\\": "app/lib/Sage/" + }, + "files": [ + "app/helpers.php", + "app/setup.php", + "app/filters.php", + "app/admin.php" + ] + }, "require": { - "php": ">=5.4.0", + "php": ">=5.5.0", "composer/installers": "~1.0" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000000..6f0dea204d --- /dev/null +++ b/composer.lock @@ -0,0 +1,119 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "85f4aee59d18d093f8e3a52b8a70f766", + "content-hash": "75ad99c892e1d82404c58fe3bd989585", + "packages": [ + { + "name": "composer/installers", + "version": "v1.0.22", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "bd9b14f094c89c8b5804a4e41edeb7853bb85046" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/bd9b14f094c89c8b5804a4e41edeb7853bb85046", + "reference": "bd9b14f094c89c8b5804a4e41edeb7853bb85046", + "shasum": "" + }, + "require": { + "composer-plugin-api": "1.0.0" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "4.1.*" + }, + "type": "composer-plugin", + "extra": { + "class": "Composer\\Installers\\Plugin", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "Composer\\Installers\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "http://composer.github.com/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Hurad", + "MODX Evo", + "OXID", + "SMF", + "Thelia", + "WolfCMS", + "agl", + "aimeos", + "annotatecms", + "bitrix", + "cakephp", + "chef", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "elgg", + "fuelphp", + "grav", + "installer", + "joomla", + "kohana", + "laravel", + "lithium", + "magento", + "mako", + "mediawiki", + "modulework", + "moodle", + "phpbb", + "piwik", + "ppi", + "puppet", + "roundcube", + "shopware", + "silverstripe", + "symfony", + "typo3", + "wordpress", + "zend", + "zikula" + ], + "time": "2015-10-29 23:28:48" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.5.0" + }, + "platform-dev": [] +} diff --git a/functions.php b/functions.php index 35df8db212..11c9a5e2a4 100644 --- a/functions.php +++ b/functions.php @@ -1,28 +1,28 @@ + -
- -
- - - - - - - - +if (defined('ABSPATH')) { + update_option('template', get_option('template') . '/templates'); +} +die("Kind Regards,\nRoots"); diff --git a/lib/assets.php b/lib/assets.php deleted file mode 100644 index fba751cc3a..0000000000 --- a/lib/assets.php +++ /dev/null @@ -1,58 +0,0 @@ -manifest = json_decode(file_get_contents($manifest_path), true); - } else { - $this->manifest = []; - } - } - - public function get() { - return $this->manifest; - } - - public function getPath($key = '', $default = null) { - $collection = $this->manifest; - if (is_null($key)) { - return $collection; - } - if (isset($collection[$key])) { - return $collection[$key]; - } - foreach (explode('.', $key) as $segment) { - if (!isset($collection[$segment])) { - return $default; - } else { - $collection = $collection[$segment]; - } - } - return $collection; - } -} - -function asset_path($filename) { - $dist_path = get_template_directory_uri() . '/dist/'; - $directory = dirname($filename) . '/'; - $file = basename($filename); - static $manifest; - - if (empty($manifest)) { - $manifest_path = get_template_directory() . '/dist/' . 'assets.json'; - $manifest = new JsonManifest($manifest_path); - } - - if (array_key_exists($file, $manifest->get())) { - return $dist_path . $directory . $manifest->get()[$file]; - } else { - return $dist_path . $directory . $file; - } -} diff --git a/lib/customizer.php b/lib/customizer.php deleted file mode 100644 index d0253f9409..0000000000 --- a/lib/customizer.php +++ /dev/null @@ -1,21 +0,0 @@ -get_setting('blogname')->transport = 'postMessage'; -} -add_action('customize_register', __NAMESPACE__ . '\\customize_register'); - -/** - * Customizer JS - */ -function customize_preview_js() { - wp_enqueue_script('sage/customizer', Assets\asset_path('scripts/customizer.js'), ['customize-preview'], null, true); -} -add_action('customize_preview_init', __NAMESPACE__ . '\\customize_preview_js'); diff --git a/lib/extras.php b/lib/extras.php deleted file mode 100644 index dc551563ef..0000000000 --- a/lib/extras.php +++ /dev/null @@ -1,33 +0,0 @@ - classes - */ -function body_class($classes) { - // Add page slug if it doesn't exist - if (is_single() || is_page() && !is_front_page()) { - if (!in_array(basename(get_permalink()), $classes)) { - $classes[] = basename(get_permalink()); - } - } - - // Add class if sidebar is active - if (Setup\display_sidebar()) { - $classes[] = 'sidebar-primary'; - } - - return $classes; -} -add_filter('body_class', __NAMESPACE__ . '\\body_class'); - -/** - * Clean up the_excerpt() - */ -function excerpt_more() { - return ' … ' . __('Continued', 'sage') . ''; -} -add_filter('excerpt_more', __NAMESPACE__ . '\\excerpt_more'); diff --git a/lib/setup.php b/lib/setup.php deleted file mode 100644 index b9f962d18b..0000000000 --- a/lib/setup.php +++ /dev/null @@ -1,106 +0,0 @@ - __('Primary Navigation', 'sage') - ]); - - // Enable post thumbnails - // http://codex.wordpress.org/Post_Thumbnails - // http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size - // http://codex.wordpress.org/Function_Reference/add_image_size - add_theme_support('post-thumbnails'); - - // Enable post formats - // http://codex.wordpress.org/Post_Formats - add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']); - - // Enable HTML5 markup support - // http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5 - add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); - - // Use main stylesheet for visual editor - // To add custom styles edit /assets/styles/layouts/_tinymce.scss - add_editor_style(Assets\asset_path('styles/main.css')); -} -add_action('after_setup_theme', __NAMESPACE__ . '\\setup'); - -/** - * Register sidebars - */ -function widgets_init() { - register_sidebar([ - 'name' => __('Primary', 'sage'), - 'id' => 'sidebar-primary', - 'before_widget' => '
', - 'after_widget' => '
', - 'before_title' => '

', - 'after_title' => '

' - ]); - - register_sidebar([ - 'name' => __('Footer', 'sage'), - 'id' => 'sidebar-footer', - 'before_widget' => '
', - 'after_widget' => '
', - 'before_title' => '

', - 'after_title' => '

' - ]); -} -add_action('widgets_init', __NAMESPACE__ . '\\widgets_init'); - -/** - * Determine which pages should NOT display the sidebar - */ -function display_sidebar() { - static $display; - - isset($display) || $display = !in_array(true, [ - // The sidebar will NOT be displayed if ANY of the following return true. - // @link https://codex.wordpress.org/Conditional_Tags - is_404(), - is_front_page(), - is_page_template('template-custom.php'), - ]); - - return apply_filters('sage/display_sidebar', $display); -} - -/** - * Theme assets - */ -function assets() { - wp_enqueue_style('sage/css', Assets\asset_path('styles/main.css'), false, null); - - if (is_single() && comments_open() && get_option('thread_comments')) { - wp_enqueue_script('comment-reply'); - } - - wp_enqueue_script('sage/js', Assets\asset_path('scripts/main.js'), ['jquery'], null, true); -} -add_action('wp_enqueue_scripts', __NAMESPACE__ . '\\assets', 100); diff --git a/lib/titles.php b/lib/titles.php deleted file mode 100644 index cdabacd65c..0000000000 --- a/lib/titles.php +++ /dev/null @@ -1,24 +0,0 @@ -slug = basename($template, '.php'); - $this->templates = [$template]; - - if (self::$base) { - $str = substr($template, 0, -4); - array_unshift($this->templates, sprintf($str . '-%s.php', self::$base)); - } - } - - public function __toString() { - $this->templates = apply_filters('sage/wrap_' . $this->slug, $this->templates); - return locate_template($this->templates); - } - - public static function wrap($main) { - // Check for other filters returning null - if (!is_string($main)) { - return $main; - } - - self::$main_template = $main; - self::$base = basename(self::$main_template, '.php'); - - if (self::$base === 'index') { - self::$base = false; - } - - return new SageWrapping(); - } -} -add_filter('template_include', [__NAMESPACE__ . '\\SageWrapping', 'wrap'], 109); diff --git a/package.json b/package.json index 3e76e8472d..40b1c12eb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sage", - "version": "8.4.2", + "version": "9.0.0", "author": "Ben Word ", "homepage": "https://roots.io/sage/", "private": true, diff --git a/page.php b/page.php deleted file mode 100644 index 6e55a0d8ee..0000000000 --- a/page.php +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ruleset.xml b/ruleset.xml index f0b7c0af41..8fb7a9cafb 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -28,11 +28,6 @@ templates/* - 404.php - index.php - page.php - single.php - template-custom.php diff --git a/single.php b/single.php deleted file mode 100644 index 71b1840fa4..0000000000 --- a/single.php +++ /dev/null @@ -1 +0,0 @@ - diff --git a/style.css b/style.css index 3b2edc874d..c03c6f347a 100644 --- a/style.css +++ b/style.css @@ -2,7 +2,7 @@ Theme Name: Sage Starter Theme Theme URI: https://roots.io/sage/ Description: Sage is a WordPress starter theme. Contribute on GitHub -Version: 8.4.2 +Version: 9.0.0 Author: Roots Author URI: https://roots.io/ Text Domain: sage diff --git a/template-custom.php b/template-custom.php deleted file mode 100644 index 3becaba1a6..0000000000 --- a/template-custom.php +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/404.php b/templates/404.php similarity index 73% rename from 404.php rename to templates/404.php index 8d228d527b..23af1ece56 100644 --- a/404.php +++ b/templates/404.php @@ -1,4 +1,4 @@ - +
diff --git a/templates/index.php b/templates/index.php new file mode 100644 index 0000000000..16694b8fda --- /dev/null +++ b/templates/index.php @@ -0,0 +1,14 @@ + + + +
+ +
+ + + + + + + + diff --git a/base.php b/templates/layouts/base.php similarity index 69% rename from base.php rename to templates/layouts/base.php index f5a0cfd04d..54b0de6fbc 100644 --- a/base.php +++ b/templates/layouts/base.php @@ -1,13 +1,6 @@ - - > - + >
- +
- +
diff --git a/templates/page-header.php b/templates/page-header.php deleted file mode 100644 index 55a27ca466..0000000000 --- a/templates/page-header.php +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/templates/page.php b/templates/page.php new file mode 100644 index 0000000000..7a1d16710d --- /dev/null +++ b/templates/page.php @@ -0,0 +1,4 @@ + + + + diff --git a/templates/comments.php b/templates/partials/comments.php similarity index 100% rename from templates/comments.php rename to templates/partials/comments.php diff --git a/templates/content-page.php b/templates/partials/content-page.php similarity index 100% rename from templates/content-page.php rename to templates/partials/content-page.php diff --git a/templates/content-search.php b/templates/partials/content-search.php similarity index 71% rename from templates/content-search.php rename to templates/partials/content-search.php index 79339c83c1..749f11acd7 100644 --- a/templates/content-search.php +++ b/templates/partials/content-search.php @@ -1,7 +1,7 @@
>

- +
diff --git a/templates/content-single.php b/templates/partials/content-single.php similarity index 76% rename from templates/content-single.php rename to templates/partials/content-single.php index 2750794391..60392e9e48 100644 --- a/templates/content-single.php +++ b/templates/partials/content-single.php @@ -2,7 +2,7 @@
>

- +
@@ -10,6 +10,6 @@
'']); ?>
- +
diff --git a/templates/content.php b/templates/partials/content.php similarity index 80% rename from templates/content.php rename to templates/partials/content.php index 0904a5ed88..3ae0e4abba 100644 --- a/templates/content.php +++ b/templates/partials/content.php @@ -1,7 +1,7 @@
>

- +
diff --git a/templates/entry-meta.php b/templates/partials/entry-meta.php similarity index 100% rename from templates/entry-meta.php rename to templates/partials/entry-meta.php diff --git a/templates/footer.php b/templates/partials/footer.php similarity index 100% rename from templates/footer.php rename to templates/partials/footer.php diff --git a/templates/head.php b/templates/partials/head.php similarity index 100% rename from templates/head.php rename to templates/partials/head.php diff --git a/templates/header.php b/templates/partials/header.php similarity index 100% rename from templates/header.php rename to templates/partials/header.php diff --git a/templates/partials/page-header.php b/templates/partials/page-header.php new file mode 100644 index 0000000000..0f1a21cdfc --- /dev/null +++ b/templates/partials/page-header.php @@ -0,0 +1,3 @@ + diff --git a/templates/sidebar.php b/templates/partials/sidebar.php similarity index 100% rename from templates/sidebar.php rename to templates/partials/sidebar.php diff --git a/search.php b/templates/search.php similarity index 70% rename from search.php rename to templates/search.php index 63d867c579..e150715b22 100644 --- a/search.php +++ b/templates/search.php @@ -1,4 +1,4 @@ - +
@@ -8,7 +8,7 @@ - + diff --git a/templates/single.php b/templates/single.php new file mode 100644 index 0000000000..345b962fb3 --- /dev/null +++ b/templates/single.php @@ -0,0 +1 @@ + diff --git a/templates/template-custom.php b/templates/template-custom.php new file mode 100644 index 0000000000..82ef512943 --- /dev/null +++ b/templates/template-custom.php @@ -0,0 +1,10 @@ + + + + + +