First pass at Blade templating
This commit is contained in:
14
templates/404.blade.php
Normal file
14
templates/404.blade.php
Normal 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
|
||||
@@ -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
19
templates/index.blade.php
Normal 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
|
||||
@@ -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(); ?>
|
||||
28
templates/layouts/base.blade.php
Normal file
28
templates/layouts/base.blade.php
Normal 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>
|
||||
@@ -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
9
templates/page.blade.php
Normal 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
|
||||
@@ -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; ?>
|
||||
38
templates/partials/comments.blade.php
Normal file
38
templates/partials/comments.blade.php
Normal 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 “%2$s”', '%1$s responses to “%2$s”', 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(__('← Older comments', 'sage')) !!}</li>
|
||||
@endif
|
||||
@if(get_next_comments_link())
|
||||
<li class="next">{!! next_comments_link(__('Newer comments →', '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>
|
||||
@@ -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 “%2$s”', '%1$s responses to “%2$s”', 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(__('← Older comments', 'sage')); ?></li>
|
||||
<?php endif; ?>
|
||||
<?php if (get_next_comments_link()) : ?>
|
||||
<li class="next"><?php next_comments_link(__('Newer comments →', '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>
|
||||
2
templates/partials/content-page.blade.php
Normal file
2
templates/partials/content-page.blade.php
Normal file
@@ -0,0 +1,2 @@
|
||||
{!! the_content() !!}
|
||||
{!! wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}
|
||||
@@ -1,2 +0,0 @@
|
||||
<?php the_content(); ?>
|
||||
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>
|
||||
11
templates/partials/content-search.blade.php
Normal file
11
templates/partials/content-search.blade.php
Normal 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>
|
||||
@@ -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>
|
||||
13
templates/partials/content-single.blade.php
Normal file
13
templates/partials/content-single.blade.php
Normal 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>
|
||||
@@ -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>
|
||||
9
templates/partials/content.blade.php
Normal file
9
templates/partials/content.blade.php
Normal 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>
|
||||
@@ -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>
|
||||
6
templates/partials/entry-meta.blade.php
Normal file
6
templates/partials/entry-meta.blade.php
Normal 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>
|
||||
@@ -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>
|
||||
@@ -1,5 +1,5 @@
|
||||
<footer class="content-info">
|
||||
<div class="container">
|
||||
<?php dynamic_sidebar('sidebar-footer'); ?>
|
||||
{{ dynamic_sidebar('sidebar-footer') }}
|
||||
</div>
|
||||
</footer>
|
||||
@@ -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>
|
||||
10
templates/partials/header.blade.php
Normal file
10
templates/partials/header.blade.php
Normal 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>
|
||||
@@ -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>
|
||||
@@ -1,3 +1,3 @@
|
||||
<div class="page-header">
|
||||
<h1><?= App\title(); ?></h1>
|
||||
<h1>{{ App\title() }}</h1>
|
||||
</div>
|
||||
1
templates/partials/sidebar.blade.php
Normal file
1
templates/partials/sidebar.blade.php
Normal file
@@ -0,0 +1 @@
|
||||
{!! dynamic_sidebar('sidebar-primary') !!}
|
||||
@@ -1 +0,0 @@
|
||||
<?php dynamic_sidebar('sidebar-primary'); ?>
|
||||
20
templates/search.blade.php
Normal file
20
templates/search.blade.php
Normal 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
|
||||
@@ -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(); ?>
|
||||
9
templates/single.blade.php
Normal file
9
templates/single.blade.php
Normal file
@@ -0,0 +1,9 @@
|
||||
@extends('layouts.base')
|
||||
|
||||
@section('content')
|
||||
@while(have_posts())
|
||||
{!! the_post() !!}
|
||||
@include('partials/content-single')
|
||||
@endwhile
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<?php get_template_part('partials/content-single', get_post_type()); ?>
|
||||
<?php endwhile; ?>
|
||||
15
templates/template-custom.blade.php
Normal file
15
templates/template-custom.blade.php
Normal 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
|
||||
@@ -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; ?>
|
||||
Reference in New Issue
Block a user