ワードプレス・ループ
投稿があるか判断
have_posts();
パラメータ無し。
投稿を読み込み、出力準備を整える
the_post();
パラメータ無し。
※$post という変数
現在操作対象となっている投稿は「$post」という変数に格納されます。the_post();はこの$postを準備してくれる必須関数なのです。
基本的なループ処理
<?php if(have_posts()): ?>
<?php while(have_posts(): the_post(); ?>
<?php the_title(‘<h2>’,’</h2>’); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else: ?>
投稿がありませーん。
<?php endif; ?>