Files
terrarei/single.php
2025-09-21 02:34:16 -03:00

112 lines
4.9 KiB
PHP

<?php
/**
* O template para exibir todos os posts individuais
*
* @package TerraDoRei
*/
get_header();
?>
<div class="single-post-container">
<main id="primary" class="site-main">
<?php
while ( have_posts() ) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post-content-area'); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-featured-image">
<?php the_post_thumbnail('terradorei-featured'); ?>
</div>
<?php endif; ?>
<div class="post-content-wrapper">
<header class="entry-header">
<?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '" class="post-category">' . esc_html( $categories[0]->name ) . '</a>';
}
?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php terradorei_post_meta(); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
</div><!-- .entry-content -->
<footer class="entry-footer">
<?php
// Se existem tags, exibe-as
if (has_tag()) :
?>
<div class="post-tags">
<span class="tags-label"><?php esc_html_e('Tags:', 'terradorei'); ?></span>
<?php the_tags('', '', ''); ?>
</div>
<?php endif; ?>
<?php terradorei_social_share(); ?>
</footer><!-- .entry-footer -->
</div>
</article><!-- #post-<?php the_ID(); ?> -->
<div class="post-navigation-container">
<?php
$prev_post = get_previous_post();
$next_post = get_next_post();
?>
<nav class="post-navigation">
<div class="nav-links">
<div class="nav-previous">
<?php if ( ! empty( $prev_post ) ) : ?>
<a href="<?php echo esc_url( get_permalink( $prev_post->ID ) ); ?>" rel="prev">
<div class="nav-thumbnail">
<?php echo get_the_post_thumbnail( $prev_post->ID, 'terradorei-thumbnail' ); ?>
</div>
<div class="nav-content">
<span class="nav-subtitle"><i class="fas fa-arrow-left"></i> <?php esc_html_e( 'Post Anterior', 'terradorei' ); ?></span>
<span class="nav-title"><?php echo esc_html( get_the_title( $prev_post->ID ) ); ?></span>
</div>
</a>
<?php else: ?>
<div class="nav-placeholder"></div>
<?php endif; ?>
</div>
<div class="nav-next">
<?php if ( ! empty( $next_post ) ) : ?>
<a href="<?php echo esc_url( get_permalink( $next_post->ID ) ); ?>" rel="next">
<div class="nav-content">
<span class="nav-subtitle"><?php esc_html_e( 'Próximo Post', 'terradorei' ); ?> <i class="fas fa-arrow-right"></i></span>
<span class="nav-title"><?php echo esc_html( get_the_title( $next_post->ID ) ); ?></span>
</div>
<div class="nav-thumbnail">
<?php echo get_the_post_thumbnail( $next_post->ID, 'terradorei-thumbnail' ); ?>
</div>
</a>
<?php else: ?>
<div class="nav-placeholder"></div>
<?php endif; ?>
</div>
</div>
</nav>
</div>
<?php
// Se os comentários estão abertos ou temos pelo menos um comentário, carregue o template de comentários.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php
endwhile; // Fim do loop.
?>
</main><!-- #main -->
</div>
<?php
get_footer();