wordpress the_content not working on page template

Many a times i have come across queries from developers or first time theme developers about not able to show the_content() on their custom template page.
The issue is that the_content() function runs inside the WP loop so for example
if (have_posts()) {
while (have_posts()) {
the_post();
the_content();
}
} ?>

This will work, but in some cases you want to call the function outside the loop – the solution for that is:
echo $post->post_content;

Let me know if you get some issues still.

%d bloggers like this: