Restructure theme, use autoloader
This commit is contained in:
36
templates/partials/comments.php
Normal file
36
templates/partials/comments.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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.php
Normal file
2
templates/partials/content-page.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php the_content(); ?>
|
||||
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>
|
||||
9
templates/partials/content-search.php
Normal file
9
templates/partials/content-search.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<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') { App\template_part('partials/entry-meta'); } ?>
|
||||
</header>
|
||||
<div class="entry-summary">
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
</article>
|
||||
15
templates/partials/content-single.php
Normal file
15
templates/partials/content-single.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<article <?php post_class(); ?>>
|
||||
<header>
|
||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||
<?php App\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>
|
||||
<?php endwhile; ?>
|
||||
9
templates/partials/content.php
Normal file
9
templates/partials/content.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<article <?php post_class(); ?>>
|
||||
<header>
|
||||
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||
<?php App\template_part('partials/entry-meta'); ?>
|
||||
</header>
|
||||
<div class="entry-summary">
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
</article>
|
||||
2
templates/partials/entry-meta.php
Normal file
2
templates/partials/entry-meta.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<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>
|
||||
5
templates/partials/footer.php
Normal file
5
templates/partials/footer.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<footer class="content-info">
|
||||
<div class="container">
|
||||
<?php dynamic_sidebar('sidebar-footer'); ?>
|
||||
</div>
|
||||
</footer>
|
||||
6
templates/partials/head.php
Normal file
6
templates/partials/head.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
12
templates/partials/header.php
Normal file
12
templates/partials/header.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<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>
|
||||
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>
|
||||
1
templates/partials/sidebar.php
Normal file
1
templates/partials/sidebar.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php dynamic_sidebar('sidebar-primary'); ?>
|
||||
Reference in New Issue
Block a user