Support » Themes and Templates » the_content() ?

  • I saved a new template as follows:

    Template Name: splash-page
    <?php get_header(); ?>
    <div id="container">
    	<div id="content">
    		<?php the_content(); ?>
    	</div><!-- #content -->
    </div><!-- #container -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    When I Add New Page and enter some content, the content does not show up when I View Page. Is ‘the_content()’ responsible for displaying content and if yes why isn’t it working?


Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi


    Forum Moderator

    There’s no Loop on that page template.

    I only want to output the content of the page, not the posts (outputting the posts would require a loop but not the content?)

    Found the solution:


    $page_data = get_page( $page_id );
    echo $page_data->post_content;




    Forum Moderator

    fyi, the loop is also used when showing just the content of a page;

    minimum example of a loop for a page template:

    <?php the_post(); the_content(); ?>

    your example would for instance not render any shortcode that might be in the page;

    do at least:

    echo apply_filters('the_content',$page_data->post_content);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘the_content() ?’ is closed to new replies.