How do I display a wordpress page content? How do I display a wordpress page content? wordpress wordpress

How do I display a wordpress page content?


@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; ?>


This is more concise:

<?php echo get_post_field('post_content', $post->ID); ?>

and this even more:

<?= get_post_field('post_content', $post->ID) ?>


@Sydney Try putting wp_reset_query() before you call the loop.This will display the content of your page.

<?php    wp_reset_query(); // necessary to reset query    while ( have_posts() ) : the_post();        the_content();    endwhile; // End of the loop.?>

EDIT: Try this if you have some other loops that you previously ran.Place wp_reset_query(); where you find it most suitable, but before you call this loop.