Skip to content
Advertisement

How do I display a wordpress page content?

I know this is really simple but it just isn’t coming to me for some reason and google isn’t helping me today.

I want to output the pages content, how do I do that?

I thought it was this:

<?php echo the_content(); ?>

Advertisement

Answer

@Marc B Thanks for the comment. Helped me discover this:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement