
1<?php2// single.php — 記事テンプレート3get_header();45while ( have_posts() ) : the_post();6 $reading_time = ceil(7 str_word_count( strip_tags( get_the_content() ) ) / 2008 );9?>10 <article <?php post_class( 'post-entry' ); ?>>11 <header class="post-entry__header">12 <h1><?php the_title(); ?></h1>13 <time datetime="<?php echo get_the_date( 'c' ); ?>">14 <?php echo get_the_date(); ?> ・ 約<?php echo $reading_time; ?>分15 </time>16 </header>17 <div class="post-entry__content">18 <?php the_content(); ?>19 </div>20 </article>21<?php22endwhile;2324get_footer();
1<?php2// single.php — 記事テンプレート3get_header();45while ( have_posts() ) : the_post();6 $reading_time = ceil(7 str_word_count( strip_tags( get_the_content() ) ) / 2008 );9?>10 <article <?php post_class( 'post-entry' ); ?>>11 <header class="post-entry__header">12 <h1><?php the_title(); ?></h1>13 <time datetime="<?php echo get_the_date( 'c' ); ?>">14 <?php echo get_the_date(); ?> ・ 約<?php echo $reading_time; ?>分15 </time>16 </header>17 <div class="post-entry__content">18 <?php the_content(); ?>19 </div>20 </article>21<?php22endwhile;2324get_footer();
SOURCE
Sho-tolog
2024 / WordPress / PHP
学んだことをアウトプットし、同じ悩みを持つ人の助けになる
MDXによる記事管理
ダークモード対応
レスポンシブデザイン
SEO最適化