Custom WP_Query with SQL directives for getting posts by authors and terms
Custom WP_Query with SQL directives for getting posts by authors and terms
Custom WP_Query with SQL directives for getting posts by authors and terms
How to add archives (with pagination) to page template?
Just build the static part of the args array, then add the conditional variables, then pass the args array to WP_Query(): // Static args $custom_query_args = array( /* static args here */ ); // Conditional arg if ( 1 == $promo ) { $custom_query_args[‘meta_query’] = array( /* meta query array */ ); } // Instantiate … Read more
Sort posts in dashboard using custom field; also include posts where field isn’t set
I don’t understand why can’t you use the post_date of the custom post type which includes date and time together? $arg = array( ‘post_type’ => ‘custom_post_type’, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’) $result = get_posts($args);
Try this: <?php $querydetails = ” SELECT wposts.* FROM $wpdb->posts wposts INNER JOIN ( SELECT post_id FROM $wpdb->postmeta wpostmeta WHERE ( ( wpostmeta.meta_key = ‘type’ AND wpostmeta.meta_value LIKE ‘%Collection1%’ ) OR ( wpostmeta.meta_key = ‘type’AND wpostmeta.meta_value LIKE ‘%Collection2%’ ) OR ( wpostmeta.meta_key = ‘type’AND wpostmeta.meta_value LIKE ‘%Collection3%’ ) OR ( wpostmeta.meta_key = ‘type’AND wpostmeta.meta_value LIKE … Read more
WP Query Bug? Cannot find out why posts are not found!
The first query gives the expected results when the date format was corrected. $query = new WP_Query(array( ‘post_type’=>’games’, ‘orderby’=>’menu_order’, ‘order’=>’asc’, ‘posts_per_page’ => 1, ‘meta_query’=> array( ‘relation’=>’AND’, array( ‘key’=>’game_date_time’, ‘value’=>$nowtoday, ‘compare’ =>’>’ ), array( ‘key’=>’home_team’, ‘value’=>’Allen’, ‘compare’=>’LIKE’ ) ) ));
Loop the posts between two dates selected using jquery datepicker
The parameter should be orderby rather than order_by. (See codex)