First pass at Blade templating

This commit is contained in:
kalenjohnson
2016-12-03 10:27:22 -08:00
parent 3c831356f2
commit 0918597d4a
38 changed files with 957 additions and 181 deletions

View File

@@ -30,7 +30,8 @@
},
"require": {
"php": ">=5.5.0",
"composer/installers": "~1.0"
"composer/installers": "~1.0",
"illuminate/view": "^5.3"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.5.1",

557
composer.lock generated
View File

@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "5f4d419852a5551e2b54ef851cab83b4",
"content-hash": "1ee82adf8a4565a48214e5686e6b3293",
"hash": "255f61d85f71037ef5fc7872e31015f1",
"content-hash": "a1a2a4510be5494654cdd98e6308e48e",
"packages": [
{
"name": "composer/installers",
@@ -104,6 +104,559 @@
"zikula"
],
"time": "2016-01-27 12:54:22"
},
{
"name": "doctrine/inflector",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Inflector\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"inflection",
"pluralize",
"singularize",
"string"
],
"time": "2015-11-06 14:35:42"
},
{
"name": "illuminate/container",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/container.git",
"reference": "8047b47e1f731c975d9aa0fe0b269064d3f1346d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/container/zipball/8047b47e1f731c975d9aa0fe0b269064d3f1346d",
"reference": "8047b47e1f731c975d9aa0fe0b269064d3f1346d",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.3.*",
"php": ">=5.6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Container\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Container package.",
"homepage": "https://laravel.com",
"time": "2016-10-02 01:14:30"
},
{
"name": "illuminate/contracts",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
"reference": "ce5d73c6015b2054d32f3f8530767847b358ae4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/ce5d73c6015b2054d32f3f8530767847b358ae4e",
"reference": "ce5d73c6015b2054d32f3f8530767847b358ae4e",
"shasum": ""
},
"require": {
"php": ">=5.6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Contracts\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Contracts package.",
"homepage": "https://laravel.com",
"time": "2016-09-26 20:36:27"
},
{
"name": "illuminate/events",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/events.git",
"reference": "cb29124d4eaba8a60bad40e95e3d8b199d040d77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/events/zipball/cb29124d4eaba8a60bad40e95e3d8b199d040d77",
"reference": "cb29124d4eaba8a60bad40e95e3d8b199d040d77",
"shasum": ""
},
"require": {
"illuminate/container": "5.3.*",
"illuminate/contracts": "5.3.*",
"illuminate/support": "5.3.*",
"php": ">=5.6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Events\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Events package.",
"homepage": "https://laravel.com",
"time": "2016-08-12 14:24:30"
},
{
"name": "illuminate/filesystem",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/filesystem.git",
"reference": "82576e0a6193e76929c929c8a2d3e1552ab64e76"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/82576e0a6193e76929c929c8a2d3e1552ab64e76",
"reference": "82576e0a6193e76929c929c8a2d3e1552ab64e76",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.3.*",
"illuminate/support": "5.3.*",
"php": ">=5.6.4",
"symfony/finder": "3.1.*"
},
"suggest": {
"league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).",
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).",
"league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Filesystem\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Filesystem package.",
"homepage": "https://laravel.com",
"time": "2016-11-07 22:09:46"
},
{
"name": "illuminate/support",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
"reference": "050d0ed3e1c0e1d129d73b2eaa14044e46a66f77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/050d0ed3e1c0e1d129d73b2eaa14044e46a66f77",
"reference": "050d0ed3e1c0e1d129d73b2eaa14044e46a66f77",
"shasum": ""
},
"require": {
"doctrine/inflector": "~1.0",
"ext-mbstring": "*",
"illuminate/contracts": "5.3.*",
"paragonie/random_compat": "~1.4|~2.0",
"php": ">=5.6.4"
},
"replace": {
"tightenco/collect": "self.version"
},
"suggest": {
"illuminate/filesystem": "Required to use the composer class (5.2.*).",
"symfony/process": "Required to use the composer class (3.1.*).",
"symfony/var-dumper": "Required to use the dd function (3.1.*)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Support\\": ""
},
"files": [
"helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Support package.",
"homepage": "https://laravel.com",
"time": "2016-11-03 15:25:28"
},
{
"name": "illuminate/view",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/view.git",
"reference": "f840676c98e3cb1224267786f35eb420de55d41c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/view/zipball/f840676c98e3cb1224267786f35eb420de55d41c",
"reference": "f840676c98e3cb1224267786f35eb420de55d41c",
"shasum": ""
},
"require": {
"illuminate/container": "5.3.*",
"illuminate/contracts": "5.3.*",
"illuminate/events": "5.3.*",
"illuminate/filesystem": "5.3.*",
"illuminate/support": "5.3.*",
"php": ">=5.6.4",
"symfony/debug": "3.1.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\View\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate View package.",
"homepage": "https://laravel.com",
"time": "2016-10-24 18:18:15"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.4",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
],
"time": "2016-11-07 23:38:38"
},
{
"name": "psr/log",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2016-10-10 12:19:37"
},
{
"name": "symfony/debug",
"version": "v3.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "c058661c32f5b462722e36d120905940089cbd9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/c058661c32f5b462722e36d120905940089cbd9a",
"reference": "c058661c32f5b462722e36d120905940089cbd9a",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/class-loader": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2016-11-15 12:55:20"
},
{
"name": "symfony/finder",
"version": "v3.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "9925935bf7144f9e4d2b976905881b4face036fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/9925935bf7144f9e4d2b976905881b4face036fb",
"reference": "9925935bf7144f9e4d2b976905881b4face036fb",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2016-11-03 08:04:31"
}
],
"packages-dev": [

View File

@@ -1,3 +1,3 @@
<?php
include __DIR__ . '/templates/index.php';
include __DIR__ . '/templates/index.blade.php';

View File

@@ -4,6 +4,9 @@ namespace App;
use Roots\Sage\Template;
use Roots\Sage\Template\Wrapper;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Roots\Sage\Template\ViewServiceProvider;
/**
* Add <body> classes
@@ -32,11 +35,62 @@ add_filter('excerpt_more', function () {
});
/**
* Use theme wrapper
* Use Blade template engine
*/
add_filter('template_include', function ($main) {
if (!is_string($main) && !(is_object($main) && method_exists($main, '__toString'))) {
return $main;
foreach(['index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', 'home', 'front_page', 'page', 'paged', 'search', 'single', 'singular', 'attachment'] as $type) {
add_filter("{$type}_template_hierarchy", function($templates) {
foreach ($templates as $template) {
$templates[] = str_replace('.php', '.blade.php', $template);
}
return $templates;
});
}
add_filter('template_include', function ($template) {
$blade_template = (!strpos($template, '.blade.php')) ? str_replace('.php', '.blade.php', $template) : $template;
$blade_template = locate_template(basename($blade_template));
if (!file_exists($blade_template)) {
return $template;
}
return ((new Template(new Wrapper($main)))->layout());
}, 109);
$container = Container::getInstance();
$container->singleton('files', function () {
return new Filesystem;
});
$provider = new ViewServiceProvider($container);
$provider->register();
$template_engine = $container->make('view');
$template_name = basename(str_replace('.blade', '', $blade_template));
$template_name = str_replace('.php', '', $template_name);
$html = $template_engine->make($template_name, apply_filters('laravel/blade/template_data', []))->render();
if (!$html) {
return $template;
}
echo $html;
return false;
}, 1000);
add_filter('comments_template', function ($theme_template) {
$container = Container::getInstance();
$template_engine = $container->make('view');
$template_name = basename(str_replace('.blade.php', '', $theme_template));
$html = $template_engine->make('partials/'.$template_name, []);
var_dump($template_engine->exists('partials/'.$template_name));
$engine = $html->getEngine();
$compiler = $engine->getCompiler();
$template = $compiler->getCompiledPath($compiler->getPath());
if ($compiler->isExpired($template)) {
$compiler->compile($theme_template);
}
return $template;
});

View File

@@ -0,0 +1,132 @@
<?php
namespace Roots\Sage\Template;
use Illuminate\View\Factory;
use Illuminate\Events\Dispatcher;
use Illuminate\View\FileViewFinder;
use Illuminate\View\Engines\PhpEngine;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Engines\CompilerEngine;
use Illuminate\View\Engines\EngineResolver;
use Illuminate\View\Compilers\BladeCompiler;
class ViewServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerEngineResolver();
$this->registerViewFinder();
$this->registerFactory();
}
/**
* Register the engine resolver instance.
*
* @return void
*/
public function registerEngineResolver()
{
$this->app->singleton('view.engine.resolver', function () {
$resolver = new EngineResolver;
// Next we will register the various engines with the resolver so that the
// environment can resolve the engines it needs for various views based
// on the extension of view files. We call a method for each engines.
foreach (['php', 'blade'] as $engine) {
$this->{'register'.ucfirst($engine).'Engine'}($resolver);
}
return $resolver;
});
}
/**
* Register the PHP engine implementation.
*
* @param \Illuminate\View\Engines\EngineResolver $resolver
* @return void
*/
public function registerPhpEngine($resolver)
{
$resolver->register('php', function () {
return new PhpEngine;
});
}
/**
* Register the Blade engine implementation.
*
* @param \Illuminate\View\Engines\EngineResolver $resolver
* @return void
*/
public function registerBladeEngine($resolver)
{
$app = $this->app;
// The Compiler engine requires an instance of the CompilerInterface, which in
// this case will be the Blade compiler, so we'll first create the compiler
// instance to pass into the engine so it can compile the views properly.
$app->singleton('blade.compiler', function ($app) {
$cache = apply_filters('roots/views/blade/compiled_path', wp_upload_dir()['basedir'] . '/cache/compiled');
if (!file_exists($cache)) {
wp_mkdir_p($cache);
}
return new BladeCompiler($app->make('Illuminate\\Filesystem\\Filesystem'), $cache);
});
$resolver->register('blade', function () use ($app) {
return new CompilerEngine($app['blade.compiler']);
});
}
/**
* Register the view finder implementation.
*
* @return void
*/
public function registerViewFinder()
{
$this->app->bind('view.finder', function ($app) {
$paths = apply_filters('roots/views/blade/template_directories', [TEMPLATEPATH]);
return new FileViewFinder($app['files'], $paths);
});
}
/**
* Register the view environment.
*
* @return void
*/
public function registerFactory()
{
$this->app->singleton('view', function ($app) {
// Next we need to grab the engine resolver instance that will be used by the
// environment. The resolver will be used by an environment to get each of
// the various engine implementations such as plain PHP or Blade engine.
$resolver = $app['view.engine.resolver'];
$finder = $app['view.finder'];
$env = new Factory($resolver, $finder, new Dispatcher($app));
// We will also set the container instance on this view environment since the
// view composers may be classes registered in the container, which allows
// for great testable, flexible composers for the application developer.
$env->setContainer($app);
$env->share('app', $app);
return $env;
});
}
}

14
templates/404.blade.php Normal file
View File

@@ -0,0 +1,14 @@
@extends('layouts.base')
@section('content')
@include('partials.page-header')
@if(!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, but the page you were trying to view does not exist.', 'sage') }}
</div>
{!! get_search_form(false) !!}
@endif
{!! get_the_posts_navigation() !!}
@endsection

View File

@@ -1,7 +0,0 @@
<?php get_template_part('partials/page-header'); ?>
<div class="alert alert-warning">
<?php _e('Sorry, but the page you were trying to view does not exist.', 'sage'); ?>
</div>
<?php get_search_form(); ?>

19
templates/index.blade.php Normal file
View File

@@ -0,0 +1,19 @@
@extends('layouts.base')
@section('content')
@include('partials.page-header')
@if(!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, no results were found.', 'sage') }}
</div>
{{ get_search_form(false) }}
@endif
@while(have_posts())
{!! the_post() !!}
@include('partials.content')
@endwhile
{{ get_the_posts_navigation() }}
@endsection

View File

@@ -1,14 +0,0 @@
<?php get_template_part('partials/page-header'); ?>
<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
<?php _e('Sorry, no results were found.', 'sage'); ?>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>

View File

@@ -0,0 +1,28 @@
<!doctype html>
<html {!! language_attributes() !!}>
@include('partials.head')
<body {!! body_class() !!}>
<!--[if IE]>
<div class="alert alert-warning">
{!! _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage') !!}
</div>
<![endif]-->
{!! do_action('get_header') !!}
@include('partials.header')
<div class="wrap container" role="document">
<div class="content row">
<main class="main">
@yield('content')
</main>
{{--@if(App\display_sidebar())--}}
{{--<aside class="sidebar">--}}
{{--{!! App\template_part('partials/sidebar') !!}--}}
{{--</aside>--}}
{{--@endif--}}
</div>
</div>
{!! do_action('get_footer') !!}
@include('partials.footer')
{!! wp_footer() !!}
</body>
</html>

View File

@@ -1,32 +0,0 @@
<!doctype html>
<html <?php language_attributes(); ?>>
<?php get_template_part('partials/head'); ?>
<body <?php body_class(); ?>>
<!--[if IE]>
<div class="alert alert-warning">
<?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage'); ?>
</div>
<![endif]-->
<?php
do_action('get_header');
get_template_part('partials/header');
?>
<div class="wrap container" role="document">
<div class="content row">
<main class="main">
<?php include App\template()->main(); ?>
</main>
<?php if (App\display_sidebar()) : ?>
<aside class="sidebar">
<?php App\template_part('partials/sidebar'); ?>
</aside>
<?php endif; ?>
</div>
</div>
<?php
do_action('get_footer');
get_template_part('partials/footer');
wp_footer();
?>
</body>
</html>

9
templates/page.blade.php Normal file
View File

@@ -0,0 +1,9 @@
@extends('layouts.base')
@section('content')
@while(have_posts())
{!! the_post() !!}
@include('partials.page-header')
@include('partials.content-page')
@endwhile
@endsection

View File

@@ -1,4 +0,0 @@
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/page-header'); ?>
<?php get_template_part('partials/content-page'); ?>
<?php endwhile; ?>

View File

@@ -0,0 +1,38 @@
<?php
if (post_password_required()) {
return;
}
?>
<section id="comments" class="comments">
@if(have_comments())
<h2>
{!! sprintf(_nx('One response to &ldquo;%2$s&rdquo;', '%1$s responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>') !!}
</h2>
<ol class="comment-list">
{!! wp_list_comments(['style' => 'ol', 'short_ping' => true]) !!}
</ol>
@if(get_comment_pages_count() > 1 && get_option('page_comments'))
<nav>
<ul class="pager">
@if(get_previous_comments_link())
<li class="previous">{!! previous_comments_link(__('&larr; Older comments', 'sage')) !!}</li>
@endif
@if(get_next_comments_link())
<li class="next">{!! next_comments_link(__('Newer comments &rarr;', 'sage')) !!}</li>
@endif
</ul>
</nav>
@endif
@endif
@if(!comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments'))
<div class="alert alert-warning">
{{ __('Comments are closed.', 'sage') }}
</div>
@endif
{!! comment_form() !!}
</section>

View File

@@ -1,36 +0,0 @@
<?php
if (post_password_required()) {
return;
}
?>
<section id="comments" class="comments">
<?php if (have_comments()) : ?>
<h2><?php printf(_nx('One response to &ldquo;%2$s&rdquo;', '%1$s responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>'); ?></h2>
<ol class="comment-list">
<?php wp_list_comments(['style' => 'ol', 'short_ping' => true]); ?>
</ol>
<?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
<nav>
<ul class="pager">
<?php if (get_previous_comments_link()) : ?>
<li class="previous"><?php previous_comments_link(__('&larr; Older comments', 'sage')); ?></li>
<?php endif; ?>
<?php if (get_next_comments_link()) : ?>
<li class="next"><?php next_comments_link(__('Newer comments &rarr;', 'sage')); ?></li>
<?php endif; ?>
</ul>
</nav>
<?php endif; ?>
<?php endif; // have_comments() ?>
<?php if (!comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments')) : ?>
<div class="alert alert-warning">
<?php _e('Comments are closed.', 'sage'); ?>
</div>
<?php endif; ?>
<?php comment_form(); ?>
</section>

View File

@@ -0,0 +1,2 @@
{!! the_content() !!}
{!! wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}

View File

@@ -1,2 +0,0 @@
<?php the_content(); ?>
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>

View File

@@ -0,0 +1,11 @@
<article {!! post_class() !!}>
<header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{{ get_the_title() }}</a></h2>
@if(get_post_type() === 'post')
@include('partials/entry-meta')
@endif
</header>
<div class="entry-summary">
{!! the_excerpt() !!}
</div>
</article>

View File

@@ -1,9 +0,0 @@
<article <?php post_class(); ?>>
<header>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php if (get_post_type() === 'post') { get_template_part('partials/entry-meta'); } ?>
</header>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div>
</article>

View File

@@ -0,0 +1,13 @@
<article {!! post_class() !!}>
<header>
<h1 class="entry-title">{{ get_the_title() }}</h1>
@include('partials/entry-meta')
</header>
<div class="entry-content">
{!! the_content() !!}
</div>
<footer>
{!! wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}
</footer>
{!! comments_template('/templates/partials/comments.blade.php') !!}
</article>

View File

@@ -1,13 +0,0 @@
<article <?php post_class(); ?>>
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php get_template_part('partials/entry-meta'); ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
</div>
<footer>
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>
</footer>
<?php comments_template('/templates/partials/comments.php'); ?>
</article>

View File

@@ -0,0 +1,9 @@
<article {!! post_class() !!}>
<header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{{ get_the_title() }}</a></h2>
@include('partials/entry-meta')
</header>
<div class="entry-summary">
{!! the_excerpt() !!}
</div>
</article>

View File

@@ -1,9 +0,0 @@
<article <?php post_class(); ?>>
<header>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php get_template_part('partials/entry-meta'); ?>
</header>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div>
</article>

View File

@@ -0,0 +1,6 @@
<time class="updated" datetime="{{ get_post_time('c', true) }}">{{ get_the_date() }}</time>
<p class="byline author vcard">
{{ __('By', 'sage') }} <a href="{{ get_author_posts_url(get_the_author_meta('ID')) }}" rel="author" class="fn">
{{ get_the_author() }}
</a>
</p>

View File

@@ -1,2 +0,0 @@
<time class="updated" datetime="<?= get_post_time('c', true); ?>"><?= get_the_date(); ?></time>
<p class="byline author vcard"><?= __('By', 'sage'); ?> <a href="<?= get_author_posts_url(get_the_author_meta('ID')); ?>" rel="author" class="fn"><?= get_the_author(); ?></a></p>

View File

@@ -1,5 +1,5 @@
<footer class="content-info">
<div class="container">
<?php dynamic_sidebar('sidebar-footer'); ?>
{{ dynamic_sidebar('sidebar-footer') }}
</div>
</footer>

View File

@@ -2,5 +2,5 @@
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php wp_head(); ?>
{!! wp_head() !!}
</head>

View File

@@ -0,0 +1,10 @@
<header class="banner">
<div class="container">
<a class="brand" href="{{ esc_url(home_url('/')) }}">{{ get_bloginfo('name', 'display') }}</a>
<nav class="nav-primary">
@if(has_nav_menu('primary_navigation'))
{!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav']) !!}
@endif
</nav>
</div>
</header>

View File

@@ -1,12 +0,0 @@
<header class="banner">
<div class="container">
<a class="brand" href="<?= esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
<nav class="nav-primary">
<?php
if (has_nav_menu('primary_navigation')) :
wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav']);
endif;
?>
</nav>
</div>
</header>

View File

@@ -1,3 +1,3 @@
<div class="page-header">
<h1><?= App\title(); ?></h1>
<h1>{{ App\title() }}</h1>
</div>

View File

@@ -0,0 +1 @@
{!! dynamic_sidebar('sidebar-primary') !!}

View File

@@ -1 +0,0 @@
<?php dynamic_sidebar('sidebar-primary'); ?>

View File

@@ -0,0 +1,20 @@
@extends('layouts.base')
@section('content')
@include('partials.page-header')
@if(!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, no results were found.', 'sage') }}
</div>
{!! get_search_form(false) !!}
@endif
@while(have_posts())
{!! the_post() !!}
@include('partials.content-search')
@endwhile
{{ get_the_posts_navigation() }}
@endsection

View File

@@ -1,14 +0,0 @@
<?php get_template_part('partials/page-header'); ?>
<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
<?php _e('Sorry, no results were found.', 'sage'); ?>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/content-search'); ?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>

View File

@@ -0,0 +1,9 @@
@extends('layouts.base')
@section('content')
@while(have_posts())
{!! the_post() !!}
@include('partials/content-single')
@endwhile
@endsection

View File

@@ -1,3 +0,0 @@
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/content-single', get_post_type()); ?>
<?php endwhile; ?>

View File

@@ -0,0 +1,15 @@
<?php
/**
* Template Name: Custom Template
*/
?>
@extends('layouts.base')
@section('content')
@while(have_posts())
{!! the_post() !!}
@include('partials.page-header')
@include('partials.content-page')
@endwhile
@endsection

View File

@@ -1,10 +0,0 @@
<?php
/**
* Template Name: Custom Template
*/
?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/page-header'); ?>
<?php get_template_part('partials/content-page'); ?>
<?php endwhile; ?>