Filtering WP_Query based on wp_postmeta keys values

This is the answer to my question: $args = array( ‘post_type’ => ‘myType’, ‘post_per_page’ => $number, ‘showposts’ => $number, ‘meta_query’ => array( array( ‘key’ => ‘month’, ‘value’ => array(date(“F”),date(“F”, strtotime(‘+1 month’))), ‘compare’ => ‘IN’ ), array( ‘key’ => ‘day’, ‘value’ => date(“j”), ‘compare’ => ‘>=’ ), array( ‘key’ => ‘year’, ‘value’ => date(“Y”), ‘compare’ => … Read more

Mix post date with post meta value using WP_Query

Finally I’ve decided to use custom sql query with get_results method. $query = “SELECT SQL_CALC_FOUND_ROWS p.*, IFNULL(m2.meta_value, p.post_date_gmt) as zen_date FROM {$wpdb->posts} p LEFT JOIN {$wpdb->postmeta} m1 ON (p.ID = m1.post_id AND m1.meta_key = ‘is-exclude’) LEFT JOIN {$wpdb->postmeta} m2 ON (p.ID = m2.post_id AND m2.meta_key = ‘is-push’) WHERE p.post_type=”post” AND p.post_status=”publish” AND m1.post_id IS NULL … Read more

Order by Date Custom Field

I have the code below (started from yours) setup as a shortcode and it works fine. When I change the direction ‘ASC’ to ‘DESC’, the sort order changes as well, so it is not ‘luck’ that posts are in the correct order. It assumes that the dates are stored yyyymmdd. NOTE that one must remove … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)