Fix #720 - Re-organize archives template
- Move posts exists check and post navigation to index.php - templates/content.php now only contains the post that's pulled in from index.php - Specific post format templates now properly work
This commit is contained in:
24
index.php
24
index.php
@@ -1,5 +1,21 @@
|
|||||||
<?php get_template_part('templates/page', 'header'); ?>
|
<?php get_template_part('templates/page', 'header'); ?>
|
||||||
<?php
|
|
||||||
$format = have_posts() ? get_post_format() : false;
|
<?php if (!have_posts()) : ?>
|
||||||
get_template_part('templates/content', $format);
|
<div class="alert">
|
||||||
?>
|
<?php _e('Sorry, no results were found.', 'roots'); ?>
|
||||||
|
</div>
|
||||||
|
<?php get_search_form(); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php while (have_posts()) : the_post(); ?>
|
||||||
|
<?php get_template_part('templates/content', get_post_format()); ?>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
|
||||||
|
<?php if ($wp_query->max_num_pages > 1) : ?>
|
||||||
|
<nav class="post-nav">
|
||||||
|
<ul class="pager">
|
||||||
|
<li class="previous"><?php next_posts_link(__('← Older posts', 'roots')); ?></li>
|
||||||
|
<li class="next"><?php previous_posts_link(__('Newer posts →', 'roots')); ?></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<?php endif; ?>
|
||||||
|
|||||||
@@ -1,34 +1,12 @@
|
|||||||
<?php if (!have_posts()) : ?>
|
<article <?php post_class(); ?>>
|
||||||
<div class="alert">
|
<header>
|
||||||
<?php _e('Sorry, no results were found.', 'roots'); ?>
|
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||||
|
<?php get_template_part('templates/entry-meta'); ?>
|
||||||
|
</header>
|
||||||
|
<div class="entry-summary">
|
||||||
|
<?php the_excerpt(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php get_search_form(); ?>
|
<footer>
|
||||||
<?php endif; ?>
|
<?php the_tags('<ul class="entry-tags"><li>','</li><li>','</li></ul>'); ?>
|
||||||
|
</footer>
|
||||||
<?php while (have_posts()) : the_post(); ?>
|
</article>
|
||||||
<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'); ?>
|
|
||||||
</header>
|
|
||||||
<div class="entry-summary">
|
|
||||||
<?php the_excerpt(); ?>
|
|
||||||
</div>
|
|
||||||
<footer>
|
|
||||||
<?php the_tags('<ul class="entry-tags"><li>','</li><li>','</li></ul>'); ?>
|
|
||||||
</footer>
|
|
||||||
</article>
|
|
||||||
<?php endwhile; ?>
|
|
||||||
|
|
||||||
<?php if ($wp_query->max_num_pages > 1) : ?>
|
|
||||||
<nav class="post-nav">
|
|
||||||
<ul class="pager">
|
|
||||||
<?php if (get_next_posts_link()) : ?>
|
|
||||||
<li class="previous"><?php next_posts_link(__('← Older posts', 'roots')); ?></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (get_previous_posts_link()) : ?>
|
|
||||||
<li class="next"><?php previous_posts_link(__('Newer posts →', 'roots')); ?></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user