How-To: Get an unordered list of posts from WP

This is a simple tip, mostly for myself, with hopes that it will help a future googler. To show the three most recent article titles from wordpress in a non-wordpress page, do the following:

index.php (non-wordpress PHP page)

<ul><?php include(“GetNews.php”); ?></ul>

GetNews.php

<?php

require(‘wp_directory/wp-blog-header.php’);
wp_get_archives(‘type=postbypost&limit=3&format=html’);

?>

Simple enough if you want to just show headlines with links to the post page.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.