Thanks for the support envision.
I’ve posted basically the same question here and here over a week ago and have received zero response so far.
I don’t like the mini-loop solution on ‘Creating a Static Front Page’ at all, but I’ll take any solution that works at the moment. However ‘Creating a Static Front Page’ gives no pointers how to add more than ID (useless…), title and permalink to the page.
If it was 100% generic php/mysql I could call probably figure out how to call data from the post_content, post_excerpt or comment_status database fields, but the mini-loop code has some elements that make no sense to me.
<?php
$how_many=5; //How many posts do you want to show
require_once('wp-config.php'); // Change this for your path to wp-config.php file ?>
<ol id="whats-new">
<?
$news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts
WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
foreach($news as $np){
printf ("<li><a href=\"index.php?p=%s\">%s</a></li>", $np->ID,$np->post_title);
}?>
</ol>
Where did the %s come from? What does it do? How can I show the lead of the story (post_excerpt?) and things like publishing date and author? The ‘Creating a Static Front Page’ page does not offer any clues at all.
I’ve tried this, but it doesn’t do anything:
<?
$how_many= 5; //How many posts do you want to show
require_once('blog/wp-config.php');
$news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code>,'post_excerpt' FROM $wpdb->posts
WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
foreach($news as $np)
{
printf ("<a href=\"%s\">%s</a>", get_permalink($np->ID),$np->post_title,$np->post_excerpt);
}
?>
I’ve also tried variations with the old WordPress code that I’d been using until 2.5.1 without problems. Nothing works.
This is extremely frustrating and annoying.