How to Run a Loop Outside of WordPress?
Posted by Alius Designs on Oct 15, 2011 in Blog, Wordpress | 0 comments
Sample below can be used on any PHP file even outside your WordPress installation.
Include Basic WordPress Functions
<?php define('WP_USE_THEMES', false);
require('/server/path/to/your/wordpress/site/wp-blog-header.php');
query_posts('showposts=1'); ?>
Run Loop
<?php while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p><a href="<?php the_permalink(); ?>" class="red">Read more...</a></p>
<?php endwhile; ?>
No related posts.




