今日はWordPressでの投稿一覧を表示するコードを書きます
とりあえずsingle.phpでのページ前提ですが基本はこちらで
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
の中に出力する投稿の内容を書いていく形です。
下記だとタイトルとそのたコンテンツについて出力します
<?php get_header(); ?>
<main>
<section>
<?php while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
</section>
</main>
<?php get_footer(); ?>