Restructure theme, use autoloader
This commit is contained in:
7
templates/404.php
Normal file
7
templates/404.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php App\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(); ?>
|
||||
14
templates/index.php
Normal file
14
templates/index.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php App\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 App\template_part('partials/content-' . (get_post_type() != 'post' ? get_post_type() : get_post_format())); ?>
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php the_posts_navigation(); ?>
|
||||
32
templates/layouts/base.php
Normal file
32
templates/layouts/base.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<!doctype html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<?php App\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');
|
||||
App\template_part('partials/header');
|
||||
?>
|
||||
<div class="wrap container" role="document">
|
||||
<div class="content row">
|
||||
<main class="main">
|
||||
<?php App\template_unwrap(); ?>
|
||||
</main><!-- /.main -->
|
||||
<?php if (App\display_sidebar()) : ?>
|
||||
<aside class="sidebar">
|
||||
<?php App\template_sidebar(); ?>
|
||||
</aside><!-- /.sidebar -->
|
||||
<?php endif; ?>
|
||||
</div><!-- /.content -->
|
||||
</div><!-- /.wrap -->
|
||||
<?php
|
||||
do_action('get_footer');
|
||||
App\template_part('partials/footer');
|
||||
wp_footer();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php use Roots\Sage\Titles; ?>
|
||||
|
||||
<div class="page-header">
|
||||
<h1><?= Titles\title(); ?></h1>
|
||||
</div>
|
||||
4
templates/page.php
Normal file
4
templates/page.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<?php App\template_part('partials/page-header'); ?>
|
||||
<?php App\template_part('partials/content-page'); ?>
|
||||
<?php endwhile; ?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<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('templates/entry-meta'); } ?>
|
||||
<?php if (get_post_type() === 'post') { App\template_part('partials/entry-meta'); } ?>
|
||||
</header>
|
||||
<div class="entry-summary">
|
||||
<?php the_excerpt(); ?>
|
||||
@@ -2,7 +2,7 @@
|
||||
<article <?php post_class(); ?>>
|
||||
<header>
|
||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||
<?php get_template_part('templates/entry-meta'); ?>
|
||||
<?php App\template_part('partials/entry-meta'); ?>
|
||||
</header>
|
||||
<div class="entry-content">
|
||||
<?php the_content(); ?>
|
||||
@@ -10,6 +10,6 @@
|
||||
<footer>
|
||||
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>
|
||||
</footer>
|
||||
<?php comments_template('/templates/comments.php'); ?>
|
||||
<?php comments_template('/templates/partials/comments.php'); ?>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<article <?php post_class(); ?>>
|
||||
<header>
|
||||
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||
<?php get_template_part('templates/entry-meta'); ?>
|
||||
<?php App\template_part('partials/entry-meta'); ?>
|
||||
</header>
|
||||
<div class="entry-summary">
|
||||
<?php the_excerpt(); ?>
|
||||
3
templates/partials/page-header.php
Normal file
3
templates/partials/page-header.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="page-header">
|
||||
<h1><?php App\title(); ?></h1>
|
||||
</div>
|
||||
14
templates/search.php
Normal file
14
templates/search.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php App\template_part('partials/header-page'); ?>
|
||||
|
||||
<?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 App\template_part('partials/content-search'); ?>
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php the_posts_navigation(); ?>
|
||||
1
templates/single.php
Normal file
1
templates/single.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php App\template_part('partials/content-single-' . get_post_type()); ?>
|
||||
10
templates/template-custom.php
Normal file
10
templates/template-custom.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: Custom Template
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<?php App\template_part('partials/page-header'); ?>
|
||||
<?php App\template_part('partials/content-page'); ?>
|
||||
<?php endwhile; ?>
|
||||
Reference in New Issue
Block a user