WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Integrating Blog into Web Site (3 posts)

  1. i601254
    Member
    Posted 4 years ago #

    I've been trying to add the my most recent 3 blog posts to my web site, just posting as links to the actual blog posts. I followed the coding example given:

    // Get the last 3 posts.
    <?php
    require('/the/path/to/your/wp-blog-header.php');
    ?>

    <?php query_posts('showposts=3'); ?>
    <?php while (have_posts()) : the_post(); ?>
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>
    <?php endwhile;?>

    This is supposed to display those 3 post titles withing a <td> tag. However, what is happening is really very strange and I will try and describe it as best I can. When I render web site page the code above does work, somewhat. The three most recent blog posts are listed. However, for some reason, the code also pulls in and inserts another page from my main web site into and before the links. So basically I get a full web page followed by the three blog links all within the <td> tags! It apparently has something to do with the "require" statement and wp-blog-header.php.

    The php code used is used as a separate file and I use the "include" statement to insert it into the web page. I've double checked the include file and the php code is EXACTLY as shown above. There is absolutely NO reference to this web page that gets inserted and rendered. You can see and example here: Index 2. Look at the lower right hand corner, that where the blog posts should be appearing and they actually do but you can't see them because it's inserting a separate web page before them. If you want to check out just the include file itself, go HERE. Look closely and you'll see the two blog posts on the left side, below the rendered page. The page itself should not be there at all, just the links to the postings.

    Any suggestions would be greatly appreciated.

  2. Samuel B
    moderator
    Posted 4 years ago #

  3. i601254
    Member
    Posted 4 years ago #

    Issue solved. The web page that was being rendered ahead of my blog links was "Services.php". So I started thinking that with a page name like that, there's a good possibility it's getting loaded when I load "wp-blog-header". I renamed web page to "svcs.php" and everything now works fine.

Topic Closed

This topic has been closed to new replies.

About this Topic