wordpress the_content not working on page template

i have a WordPress template page, which shows header, footer and sidebar, but the content not showing up anyone can help?

<?php
/**
 * Template Name: Template 2
 */
?>

<?php get_header(); ?>

<div class="main_right" style="float:right;">
    <?php get_sidebar(1); ?>                        
 </div> 
<div style="float:left">    

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php echo the_content();?>

<?php endwhile; endif; ?>
</div>

<?php get_footer(); ?>

Related posts

Leave a Reply

1 comment

  1. Is this within your wordpress loop? It has to be in order for the_content to work.

    Also, you don’t need to echo the function, just place it in your file like so…

    <?php the_content(); ?>
    

    Also, why would you want to wrap the content in <p> tags? WordPress does this for you automatically. If you want to wrap it something a <div> would be much better, probably with a class or id for css use.

    Have you had a look at the wordpress codex? – http://codex.wordpress.org/Function_Reference/the_content