I’m developing a plugin made on the original calendar. My wordpress is based on real events and I want to keep trace of theme on the calendar.
So I added a custom field in the post which is the end of the events (or the last day for subriscribe) with the value of a date of course (like 25/02/2010).
Now I want to display on the calendar all the events that ends on the days instead of the posts create in each days.
How to get the meta data value of the post in this query?
// Get days with posts
$dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth'
AND YEAR(post_date) = '$thisyear'
AND post_type = 'post' AND post_status = 'publish'
AND post_date < '" . current_time('mysql') . ''', ARRAY_N);
It have to select all the post with my custom meta value.
Hope I’m not doing this for nothing, I googled and no plugin with this function came out.
I think you can do a left join :
Where “subscribe” it’s the name of your custom field. So your code could be: