Okay, I'm working on a site that is using WordPress as the blog engine in ./wordpress/ folder. I've got my own CSS design for the main pages - the blog is separated somewhat from the rest of the site.
I want to include snippets from the posts on the main static page (index.php). I have already figured out how to include the name of the post and a link, but I'd like to get the time and the first sentence or two as well.
With some fiddling and some help from the Codex, I managed to get the first part working without messing with my design. The problem is I don't know the PHP code/variables to call in order to get those things to appear.
This is the code I'm using now:
At the top of the document --
<?php
define('WP_USE_THEMES', false);
require('./wordpress/wp-blog-header.php');
?>
That allowed me to call the WP stuff without using any of the formatting style.
Now, in the place where I'm calling the blog posts:
<?php
$how_many=3; //How many posts do you want to show ?>
<ul class="whats-new">
<?
$news=$wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts
WHERE post_status = "publish" ORDER BY ID DESC LIMIT ".$how_many);
foreach($news as $np){
printf ("<li><a>%s</a></li>", $np->ID,$np->post_title);
}?>
This code is giving me the post titles, but I can't figure out what the variables are that I need and where to put them.
Can anybody help me figure this out? Many thanks in advance.