<?php
/**
 * Single Post Template
 *
 * @package Rifeng_Weifang
 */

get_header();
?>

<div class="page-header">
    <div class="container">
        <h1><?php the_title(); ?></h1>
        <?php rf_breadcrumb(); ?>
    </div>
</div>

<section class="page-content">
    <div class="container">
        <?php while ( have_posts() ) : the_post(); ?>
            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <div class="entry-meta" style="margin-bottom:24px;color:#999;font-size:14px;">
                    <span>📅 <?php echo get_the_date( 'Y年m月d日' ); ?></span>
                    <span style="margin-left:16px;">👤 <?php the_author(); ?></span>
                    <?php if ( has_category() ) : ?>
                        <span style="margin-left:16px;">📂 <?php the_category( ', ' ); ?></span>
                    <?php endif; ?>
                </div>
                
                <?php if ( has_post_thumbnail() ) : ?>
                    <div style="margin-bottom:32px;border-radius:8px;overflow:hidden;">
                        <?php the_post_thumbnail( 'large' ); ?>
                    </div>
                <?php endif; ?>
                
                <div class="entry-content">
                    <?php the_content(); ?>
                </div>
                
                <?php
                wp_link_pages( array(
                    'before' => '<div class="page-links">' . __( 'Pages:', 'rifeng-weifang' ),
                    'after'  => '</div>',
                ) );
                ?>
                
                <!-- Post Navigation -->
                <div style="margin-top:40px;padding-top:24px;border-top:1px solid #e5e7eb;display:flex;justify-content:space-between;gap:16px;">
                    <div>
                        <?php
                        $prev_post = get_previous_post();
                        if ( $prev_post ) :
                        ?>
                            <span style="font-size:13px;color:#999;">上一篇</span>
                            <a href="<?php echo get_permalink( $prev_post ); ?>" style="display:block;font-size:15px;color:#0281cc;margin-top:4px;">
                                <?php echo esc_html( $prev_post->post_title ); ?>
                            </a>
                        <?php endif; ?>
                    </div>
                    <div style="text-align:right;">
                        <?php
                        $next_post = get_next_post();
                        if ( $next_post ) :
                        ?>
                            <span style="font-size:13px;color:#999;">下一篇</span>
                            <a href="<?php echo get_permalink( $next_post ); ?>" style="display:block;font-size:15px;color:#0281cc;margin-top:4px;">
                                <?php echo esc_html( $next_post->post_title ); ?>
                            </a>
                        <?php endif; ?>
                    </div>
                </div>
                
                <?php
                // If comments are open or we have at least one comment, load up the comment template.
                if ( comments_open() || get_comments_number() ) :
                    comments_template();
                endif;
                ?>
            </article>
        <?php endwhile; ?>
    </div>
</section>

<?php get_footer();
