【wordpess】the_content()でpostの内容が表示されない

スポンサーリンク

wordpressをいじっているとthe_content()でPOSTの内容が出力されない時がありました。

色々調べてみると、記事表示ループが

<?php if ($loop->have_posts()) :
<?php the_title(); ?>
<?php the_content(); ?>
<?php else ?>
<?php endif; ?>

の場合the_contentのみダメ。the_titleはOK

<?php if(have_posts()): while(have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; endif; ?>

と、ループをWhile含めて全部書くとOKでした。

固定ページの本文 – ヒイロの日記さんのブログが大変参考になりました。ありがとうございます。