Return to Snippet

Revision: 32726
at October 2, 2010 00:59 by Mat_


Initial Code
$myrows = $wpdb->get_results("
	SELECT wposts.post_title, wposts.ID 
	FROM $wpdb->posts wposts
	LEFT JOIN $wpdb->term_relationships ON(wposts.ID = $wpdb->term_relationships.object_id)
    LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
    LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)
    LEFT JOIN $wpdb->postmeta ON(wposts.ID = $wpdb->postmeta.post_id)
	WHERE wposts.post_status = 'publish'
	AND wposts.post_type = 'concerts'
	AND $wpdb->postmeta.meta_key = 'DateConcert' 
	AND CAST($wpdb->postmeta.meta_value AS DATE) > '".date("Y-m-d H:i:s")."'
	AND CAST($wpdb->postmeta.meta_value AS DATE) < '".date("Y-m-d H:i:s", $date2)."'
	AND $wpdb->term_taxonomy.taxonomy = 'Genres'
    AND $wpdb->terms.slug = 'Jazz'  
	ORDER BY CAST($wpdb->postmeta.meta_value AS DATE) ASC
	");

Initial URL
http://www.kune-studio.com

Initial Description

                                

Initial Title
Display wordpress posts with custom date meta value, ordered by this date, with a defined taxonomy

Initial Tags
date, post, wordpress

Initial Language
PHP