How to integrate WordPress into an existing site

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?”

Latest blog posts

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:

define(‘WP_USE_THEMES’, false);

<?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; ?>

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.