How to display wordpress posts outside the blog?

For example, your main site is ,and your blog is If you want so 5 latest post description at, how to do?

Simple, the following code will meet your needs:

// Include WordPress
define(‘WP_USE_THEMES’, false);

<?php while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p><a href=”<?php the_permalink(); ?>”>Read more…</a></p>
<?php endwhile; ?>

 copy the above code at the proper file, you can have a test also, save the code to test.php.

King Php Science Welcome, you are from: