如何显示 wordpress 页面内容?
我知道这真的很简单,但由于某种原因它没有来找我,谷歌今天也没有帮助我。
我想输出页面内容,我该怎么做?
我以为是这样的:
<?php echo the_content(); ?>
我知道这真的很简单,但由于某种原因它没有来找我,谷歌今天也没有帮助我。
我想输出页面内容,我该怎么做?
我以为是这样的:
<?php echo the_content(); ?>
@Marc B 感谢您的评论。帮助我发现了这个:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
这更简洁:
<?php echo get_post_field('post_content', $post->ID); ?>
还有更多:
<?= get_post_field('post_content', $post->ID) ?>