I tend to disagree with Mr. Chait;
While it’s true that using a feed is inherently more flexible then hardcoding a db query, it’s also a whole lot more work for the average joe – who doesn’t specialise in XML.
Also, running a simple query per page-load even without caching isn’t going to cause any problems for the vast majority of WP users.
RE: showing drafts and so on accidentally, it’s a simple matter or adding into your SQL query “WHERE post_status=’publish'” to make sure you don’t get any but the posts you want.
After about a minutes work I ended up with this query;
<h4>Recent Articles</h4>
<ul>
<?
$db = mysql_connect("localhost","db-user","db-password") or die("Problem connecting");
mysql_select_db("db_name") or die("Problem selecting database");
$recentblog = mysql_query("SELECT * FROM wp_posts WHERE post_status='publish' ORDER BY post_date DESC LIMIT 5");
while($row = mysql_fetch_array($recentblog)){
// Build your formatted results here.
echo "<li><a href="".$row['guid']."">".$row['post_title']."</a></li>";
}
?>
</ul>
I’d say that using something along those lines is going to be much more practical for most WP users.
As for Jacob’s ugly GUI problem, I’ve messed around with my wordpress quite alot so I don’t know if I’d be getting a-typical results, but it seems all my posts bar the first few had their correct ‘pretty’ GUI addresses.
Otherwise you’re going to have to run a query that’s a bit more complex in order to grab the category name for each post, appending the stub [post_name] to the end of it.
ie. echo "<a href="https://yourblogaddress.com/$category/".$row['post_name']."">".$row['post_title']."</a>";
In that case – and again, I’m not sure how prevalent the wrong-GUI thing will be – I guess it may be more practical for one to use a feed-based list.