Support » Fixing WordPress » Embeding Content of a Page into a Static HTML Page

  • I’m pretty new to WordPress and am trying to learn how to create custom themes. Right now I have my home page pretty well laid out and there are 2 areas on it I need editable through WordPress. One is a box on the left side bar which displays the most recent post and the other is a little area under the navigation bar that gives a short welcome. I have the side bar piece working but I can’t get the welcome area to show the right thing. I have my permalinks set to show the post title and I’ve named this page welcome. This is the code I have where the welcome area is in the html:

    <?php $recent = new WP_Query(“page_id=**welcome**”); while($recent->have_posts()) : $recent->the_post();?>
    <?php the_content(); ?>
    <?php endwhile; ?>

    The problem is instead of displaying the content of the welcome page it displays the most recent post. Can anyone tell me what I’m doing wrong?

    You can see the page I’m working on here:


Viewing 3 replies - 1 through 3 (of 3 total)
  • Code between backticks, please.

    This line:

    while($recent->have_posts()) : $recent->the_post();?> is what displaying the most recent post.

    Why don’t you just use a static home page, which WP supports natively?

    Thanks. I’m apologize about not putting the code between backticks. It’s my first time on the forum.

    Yes now I see that line is what’s causing the problem. I thought that since it specifies the page ID it would display the content from that page but apparently not. Is there some way to get the content of the welcome page displayed there instead of the most recent post?

    I don’t know how to use a static page that WP supports natively. Can you point me in the direction of how to go about that?

    I appreciate your time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Embeding Content of a Page into a Static HTML Page’ is closed to new replies.