How do I include Page Content in a page? (6 posts)

  1. bobdobbs
    Posted 5 years ago #

    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 ?

  2. jrav001
    Posted 5 years ago #

    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?

  3. bobdobbs
    Posted 5 years ago #


    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)

  4. jrav001
    Posted 5 years ago #

    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.

  5. incluye
    Posted 5 years ago #

    Are you using the Loop and the_content()?

  6. Fastone
    Posted 4 years ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Topic