Hi, im looking to pull 3 posts from a specific Wordpress Category. At the minute I can pull 3 latest posts and display them in a flash banner using the code below.
SELECT yah_posts.*, yah_postmeta.*
FROM yah_posts
LEFT JOIN yah_postmeta ON yah_posts.ID = yah_postmeta.post_id
WHERE yah_postmeta.meta_key = 'largeimage' && yah_posts.post_status = 'publish'
ORDER BY post_date DESC LIMIT 3
I want to be able to pull 3 latest posts from a specific category instead of just 3 latest posts from every category.
I have put together this code below, but it doesn't seem to be working
$query = "SELECT yah_posts.*, yah_postmeta.*
FROM yah_posts
LEFT JOIN yah_postmeta ON yah_posts.ID = yah_postmeta.post_id
AND LEFT JOIN $yah_term_taxonomy ON($yah_term_relationships.term_taxonomy_id = $yah_term_taxonomy.term_taxonomy_id)
WHERE yah_postmeta.meta_key = 'largeimage' && yah_posts.post_status = 'publish'
AND $yah_term_taxonomy.term_id = '1'
AND $yah_term_taxonomy.taxonomy = 'category'
ORDER BY post_date DESC LIMIT 3";