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

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; ?>