The following query, adapted from the above, solved my specific problem, which was simply to capture the last four messages and their color images. Plus post_name from which I could build a pretty url
SELECT title, post_name, date, content, CONCAT(LEFT(image, LENGTH(image) - LOCATE('.', REVERSE(image))),'-150x150.',SUBSTRING_INDEX(image, '.', -1)) AS image FROM ( SELECT p.post_title AS title, p.post_status AS 'status', p.post_date AS date, p.post_content AS content, p.post_name AS post_name, (SELECT `guid` FROM wp_posts WHERE id = m.meta_value) AS image FROM wp_posts p, wp_postmeta m WHERE p.post_type = 'post' AND p.post_status = 'publish' AND p.id = m.post_id AND m.meta_key = '_thumbnail_id' ORDER BY date DESC LIMIT 4 ) TT
Of course, it’s easy to make an excerpt from there, etc., using:
for($i=0; $i< $num_rows; $i++){ $post_content = mysql_result($query_result, $i, "content"); $post_excerpt = substr($post_content, 0, 90); $post_permalink = $post_url . mysql_result($query_result, $i, "post_name"); echo $post_permalink;
mayersdesign
source share