Support » Themes and Templates » How do I include Page Content in a page?

  • What I’m trying to achieve:

    I would like a page as the front page, that shows content added via wordpress admin interface.

    So far I’ve managed to create a page and associate it with a page template. I have managed to have wordpress display my page as the sites landing page. So far, so good.

    I can log in to the admin page and edit textual content for this page.

    However, I can’t figure out how to get this content to show up on this page when it is displayed by the browser.

    How do I do this?

    I’ve been going over this page in the docs:

    However, it doesn’t seem to show how to do this. And the examples don’t cover what I want, even though there is a section titled “using wordpress as a CMS.”

    How can I achieve this ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Have you made a template specifically for use as your frontpage? If so, you can add the code to display specific posts (or pages) or display a specific post category. Is this what you are trying to do?


    Yes, I have made a template specifically for the use of the frontpage, and I’ve set my Page to use that template.

    Then I log into the admin interface, go to pages > edit, and add content.

    I figure that I need to add code to display the content for that page. But I can’t figure out what the particular code is. Nor can I find an example.

    What is the code that I need to use to display the content for that page?
    Is there an example anywhere?

    (I don’t want to display blog posts)

    This will do what you want.

    $post_id = 12;
    $queried_post = get_post($post_id);
    <h2><?php echo $queried_post->post_title; ?></h2>
    <?php echo $queried_post->post_content; ?>

    You have to change the $post_id number to the post you want to use.

    Are you using the Loop and the_content()?

    Just to comment this, working really good for me. Just remember to change the post id for the post og page your getting content from.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I include Page Content in a page?’ is closed to new replies.