Please subscribe to my feed.
WordPress is a very powerful content management system, which is specifically designed as a blogging platform. You can use WordPress as what it’s designed for, a blog, or customize it into a full fledge CMS website with the help of nothing but freely available plugins.
However what’s more common is perhaps you are installing WordPress in a sub-folder of an existing website, and after blogging for a while, you are thinking “Hey, how can I list my blog posts on my homepage?”

It’s really easy actually because WordPress has made life so much easier for us. In order to use any functions in WordPress (such as display latest blog posts, display latest comments, etc), you simply need to include the file “wp-blog-header.php”. For example, to display my latest 10 blog posts in my Flash Games page, I simply put the following few lines of code:
<?php
define(‘WP_USE_THEMES’, false);
require(‘../wp-blog-header.php’);
query_posts(‘showposts=10′);
?><ul>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a><br />
<?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’), ‘grey’); ?>
<?php endwhile; else: ?><?php endif; ?>
</ul>
Apart from display the latest 10 posts, it also displays the number of comments each post has.
OK, the codes above may look a little gibberish, but the important thing is by including the file “wp-blog-header.php”, you will have access to all the WordPress functions in an instant!
Wonderful isn’t it? With this you can easily integrate WordPress into your existing website and make the website easier to update by making use of WordPress CMS capability.
larry
June 11th, 2008 at 12:26 pm
nice article dude. We love to use WordPress too and combine with our own website.
ahyuen
June 12th, 2008 at 12:29 am
Good !. Please post more of wordpress thingy.
Kitkat
June 12th, 2008 at 2:58 pm
Larry,
Glad you like the article. I guess this is a nice tip for people looking at integrating their site with WordPress.
Ahyuen,
Sure, I will – when ideas and inspirations strike.
turbo
June 26th, 2008 at 10:07 pm
Hello, i really enjoy your post couldn’t understand it. Can you help me integrate mine? please!!!! You can refer to my mail address for response. thanks
Murray
July 16th, 2008 at 11:46 am
I have an existing site and i want to have a news and events section on the home page with ten most recent entries. I want the user to be able to generate the news items themselves without having to touch the actual html webpage. This sounds like a possible approach for my situation. Do you have any advice or tips?
Thanks
WEez
July 19th, 2008 at 12:39 pm
Hello, I enjoyed your information. I have been reading up on this intergration for a while. I am still a noob.
Like Murray I want to have a blog section set up with just the last 10 entries listed, with out any other links or actions available on that page.
Would you please take a moment and help me out a bit? You may contact me via email.
Thank you very much.
Kitkat
July 21st, 2008 at 6:42 pm
Turbo, Murray and WEez,
I thought I have listed what you need to do fairly clearly in my article? Hmm… at what point you are stuck?
What error message you are getting?
Furious Photographers
August 2nd, 2008 at 12:41 am
You’re awesome man! I have been trying to find something like this for my wedding photography blog/website. Thanks!
lamb3rt
February 15th, 2009 at 2:08 am
Hi , I have a problem message ,I realy don’t know Why , Parse error: syntax error, unexpected ‘=’ in /home/clamb3rt/www/lamb3rtproduction.com/blog/blog.php on line 259
and this line is query_posts(’showposts=10′);
my directory of wp-blog-header.PHP is ok
Can you help me?
lamb3rt
March 2nd, 2009 at 12:06 am
anyone?
jt
July 25th, 2009 at 7:08 pm
I ‘ve got the same syntax error. It’s because of the quotations. When you copy the code above, the quotations copy weird…
So you need to replace each quotation in the code with
”
or
‘
hope this helps
Migraine Causes
April 16th, 2010 at 4:42 pm
Good Idea, your blog really contains many helpful tips for blogging.
Registry Cleaner Reviews
June 17th, 2010 at 3:33 am
Thanks for this
information
Dono
August 9th, 2010 at 9:53 am
Cool.
I tried this but the links don’t work.
How do I get the hyperlinks to point to where they should?
Learn Qigong Online
June 6th, 2011 at 7:39 am
Quite useful. This post got me started making a custom site where I also display my blog posts inside my site. I have a fully functional blog inside my own page, kinda neat. Thanks!
Clean Registry
June 17th, 2011 at 12:33 pm
Wow that’s hilarious lol. I really enjoy you guys stuff, ty again for making this.
Grant and Scholarship
August 30th, 2011 at 10:27 pm
i tried the tips but the don’t work, ill try again tomorrow.
catrina
October 9th, 2011 at 2:34 am
My home page is index.html does it have to be changed to index.php for this to work or can I just insert the code above in my index.html sidebar? My blog is in catrinasgarden.com/blog and the content is on index.php won’t there be a conflict if both are named index.php ? I would like to have the loop in the side bars of my homepage with last 3 posts, post catagories, comments and archives just like on my blog page.
Thanks for your help!