カテゴリー︎: 【WordPress】
wordpressには便利な機能がたくさんあります。
必要ない機能もたくさんあります…が
 
記事を投稿して、表示するという超基本中の基本
 
 
wordpressはphpのプログラムで動いています。
 
<?php if(have_posts()): while(have_posts()):the_post();?> <?php the_content(); ?> <?php endwhile; endif; ?>
ループの解説
投稿した記事があるかを判定して、 if(have_posts())
 
記事がある間はループします while(have_posts())
 
記事を取得します。 the_post()
 
記事を出力します。 the_content()
 
記事が無くなればループを終了し endwhile
 
完了します。 endif
 
これだけで投稿した、記事が出力できます。