EDIT:
heres my file thats running the query maby its something else acting up - http://pastebin.com/4Cw3xMEM
this works as a direct query in SQLyog
SELECT * FROM wp_posts
WHERE post_status = 'publish'
AND post_type = 'post'
AND YEAR(post_date)=2010
ORDER BY post_date DESC;
it returns the three posts which are from 2010 but when i try run it via my wordpress it pumps out all the posts, regardless of date
i know theres a few things to be done so it selects the correct tables and as far as i can gather, the following 'should' be alright
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.post_status = 'publish'
AND wposts.post_type = 'post'
AND YEAR(wposts.post_date)=2010
ORDER BY wposts.post_date DESC;
i really dont understand the ' wposts. ' at all, but it uses this sort of thing in the examples on wordpress codex
the ultimate goal is to make a query to pull posts froma certain year, and use that to make WP display groups of posts per year
i cant find anything that helps explain how to properly call the querys using the wordpress structure
if someone can explain a few of these things it might help alot, example, with the following:
$wpdb->posts
i have no idea what '->' is for, i have only seen it used in php for assigning parts of an array in a foreach
- how do i get this thing to work?