feat(template): menambahkan single.php untuk tampilan baca artikel penuh

This commit is contained in:
Mas Budi Kusuma
2026-09-15 21:04:46 +07:00
parent e3607c08a2
commit 937613ac25
+57
View File
@@ -0,0 +1,57 @@
<?php
/**
* Template untuk menampilkan satu artikel/postingan penuh.
*/
get_header();
?>
<main id="primary" class="site-main" style="padding: 60px 20px; max-width: 900px; margin: 0 auto; min-height: 70vh;">
<?php
while ( have_posts() ) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'card-style' ); ?> style="padding: 40px;">
<header class="entry-header text-center" style="margin-bottom: 30px;">
<h1 class="entry-title" style="color: var(--heading-color); margin-bottom: 15px; font-weight: 800; font-size: 32px;">
<?php the_title(); ?>
</h1>
<div class="entry-meta" style="color: #64748b; font-size: 14px;">
<span style="margin-right: 15px;">📅 <?php echo get_the_date(); ?></span>
<span>👤 <?php the_author(); ?></span>
</div>
</header>
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail" style="margin-bottom: 40px; border-radius: var(--radius); overflow: hidden;">
<?php the_post_thumbnail( 'full', array( 'style' => 'width: 100%; height: auto; display: block;' ) ); ?>
</div>
<?php endif; ?>
<div class="entry-content" style="line-height: 1.8; color: var(--text-color); font-size: 16px;">
<?php
the_content();
// Paginasi jika artikel dipecah menjadi beberapa halaman dengan tag <!--nextpage-->
wp_link_pages( array(
'before' => '<div class="page-links" style="margin-top: 30px; font-weight: bold;">' . esc_html__( 'Halaman:', 'edukarsa' ),
'after' => '</div>',
) );
?>
</div>
<footer class="entry-footer" style="margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee; text-align: center;">
<a href="<?php echo esc_url( get_permalink( get_option( 'page_for_posts' ) ) ); ?>" class="btn-outline-primary">
&laquo; Kembali ke Daftar Berita
</a>
</footer>
</article>
<?php
endwhile;
?>
</main>
<?php
get_footer();
?>