How to limit posts to 1 from each term with tax_query?

<?php $categories = array(‘economy’,’the-constitution’,’monetary-policy’,’liberty’); foreach($categories as $category) { $args = array( ‘posts_per_page’ => 1, ‘category_name’ => $category, ‘tax_query’ => array( array( ‘taxonomy’ => ‘highlight’, ‘field’ => ‘slug’, ‘terms’ => array( ‘lead’,’featured’ ), ‘operator’ => ‘NOT IN’ ) ) ); $wpse42358_query = new WP_Query( $args ); while( $wpse42358_query->have_posts() ) : $wpse42358_query->the_post(); // write post stuff here … Read more

Second wp_query doesn’t appear to be working

Because you’re calling get_post_permalink etc, I think you may need to add wp_reset_postdata(); as well, per this section in the codex: http://codex.wordpress.org/Class_Reference/WP_Query#Interacting_with_WP_Query Hope this helps, best of luck!

query_posts, oderby meta_value & print “future” posts

I would suggest storing the date-times as either: Timestamp (to sort/compare by meta_value_num) ‘yyyy-mm-dd hh:mm (e.g. 2012-04-11 19:37) to sort/compare by meta_value Then the following will work (assuming you’re using timestamp): $now = current_time(‘timestamp’); $args = array( ‘post_type’ => ‘rides’, ‘posts_per_page’ => 3, ‘meta_query’ => array( array( ‘key’ => ‘date’, ‘value’ => $now, ‘compare’ => … Read more

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