Reduce comment padding and move post navigation below comments using card template
This commit is contained in:
87
single.php
87
single.php
@@ -69,59 +69,46 @@ get_header(); ?>
|
||||
?>
|
||||
</div>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-<?php the_ID(); ?> -->
|
||||
|
||||
<div class="mx-auto px-3" style="max-width: 680px;">
|
||||
<nav class="navigation post-navigation mt-5 border-top border-bottom py-4" aria-label="Posts">
|
||||
<div class="row justify-content-between g-4">
|
||||
<div class="col-md-6 text-start">
|
||||
<?php
|
||||
$prev_post = get_previous_post();
|
||||
if (!empty($prev_post)):
|
||||
?>
|
||||
<a href="<?php echo esc_url(get_permalink($prev_post->ID)); ?>"
|
||||
class="text-decoration-none d-flex align-items-center gap-3">
|
||||
<?php if (has_post_thumbnail($prev_post->ID)): ?>
|
||||
<?php echo get_the_post_thumbnail($prev_post->ID, 'thumbnail', array('class' => 'post-nav-thumbnail shadow-sm')); ?>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<div class="text-muted small fw-bold mb-1 text-uppercase tracking-wider">Previous</div>
|
||||
<div class="fw-bold text-dark lh-sm"><?php echo esc_html($prev_post->post_title); ?>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col-md-6 text-end">
|
||||
<?php
|
||||
$next_post = get_next_post();
|
||||
if (!empty($next_post)):
|
||||
?>
|
||||
<a href="<?php echo esc_url(get_permalink($next_post->ID)); ?>"
|
||||
class="text-decoration-none d-flex align-items-center justify-content-end gap-3 text-end">
|
||||
<div>
|
||||
<div class="text-muted small fw-bold mb-1 text-uppercase tracking-wider">Next</div>
|
||||
<div class="fw-bold text-dark lh-sm"><?php echo esc_html($next_post->post_title); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (has_post_thumbnail($next_post->ID)): ?>
|
||||
<?php echo get_the_post_thumbnail($next_post->ID, 'thumbnail', array('class' => 'post-nav-thumbnail shadow-sm')); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="mx-auto px-3 mb-3" style="max-width: 680px;">
|
||||
<?php
|
||||
// If comments are open or we have at least one comment, load up the comment template inside the constrained column.
|
||||
if (comments_open() || get_comments_number()):
|
||||
comments_template();
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// If comments are open or we have at least one comment, load up the comment template inside the constrained column.
|
||||
if (comments_open() || get_comments_number()):
|
||||
comments_template();
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
$prev_post = get_previous_post();
|
||||
$next_post = get_next_post();
|
||||
if (!empty($prev_post) || !empty($next_post)):
|
||||
?>
|
||||
<div class="mt-5 pt-5 border-top">
|
||||
<h3 class="h4 font-serif fw-bold mb-4 text-center">More Articles</h3>
|
||||
<div class="row justify-content-center gx-4 gy-4">
|
||||
<?php
|
||||
global $post;
|
||||
$original_post = $post;
|
||||
|
||||
<?php endwhile; // End of the loop. ?>
|
||||
if (!empty($prev_post)) {
|
||||
$post = $prev_post;
|
||||
setup_postdata($post);
|
||||
get_template_part('template-parts/content', 'card');
|
||||
}
|
||||
if (!empty($next_post)) {
|
||||
$post = $next_post;
|
||||
setup_postdata($post);
|
||||
get_template_part('template-parts/content', 'card');
|
||||
}
|
||||
|
||||
$post = $original_post;
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endwhile; // End of the loop. ?>
|
||||
</main><!-- #main -->
|
||||
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user