Hi,
I've written a PHP script to access the latest item from the wordpress database, which it does. But I need to use it twice, once for the latest item from a specific category, and another from a differerent category...
But right now I cannot figure out how to put the query together.
The post has a post_parent, which in another table, called wp_term_relationships, is referred to as object_id, and has a term_taxonomy_id, which then relates to a different table, called wp_terms where the term_taxonomy_id is now term_id and then you have the category slug name available to select...
I really cannot understand how this query would work though.
I've made a really crap mock up of it, to try to "visually" explain what i'm trying to do...
SELECT *
FROM `wp_posts`
WHERE post_status = 'publish'
AND (SELECT term_taxonomy_id FROM wp_term_relationships WHERE object_id = post_parent)
AND (SELECT slug FROM wp_terms WHERE term_id = term_taxonomy_id)
ORDER BY ID DESC
LIMIT 1
Really would appreciate some help... Thanks.