Recently, we needed to develop a website that used a blogging system – but didn’t¬†necessarily¬†want to use the blog to power the full website as we had other plans for that.

In a nutshell all we really needed was to be able to include a top 10 latest articles list from our WordPress blog on the home and left handside of every page.

In the past, we probably would have used a RSS feed parser to include the latest list, but this was never very clean for us. After much searching on the web we eventually came up with a combined solution and here it is forever embedded on my blog so we don’t have to search the next time round:

<?php
      require('pathto/blog/wp-blog-header.php'); // change this to fit your path
      query_posts('showposts=10');
?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>

<?php endwhile; ?>
Be Sociable, Share!