meta queries do ‘either/or’ checks

meta_query works on ‘both/and’ checks and also ‘either/or’.so don’t worry.your coding was correct.this is the actual format… $a = new WP_Query( array( ‘fields’ => ‘ids’, ‘ignore_sticky_posts’ => true, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘foo’, ‘value’ => array( ‘foobar’ ), ‘compare’ => ‘IN’ ), array( ‘key’ => ‘bar’, ‘value’ => array( ‘foobar2’ … Read more

Search by meta_query

You should look into meta_query: $args = array( ‘meta_query’ => array( ‘key’ => ‘event_start_timestamp’, // the name of the meta ‘value’ => ’11/21/2011′, // the value to search for ‘compare’ => ‘>=’, //search for start dates bigger or equal to value ) ); $query = new WP_Query( $args );

Create an archive listing based on meta array

Have you looked at PHP’s date function? A quick example : $dates = $wpdb->get_col( /*your sql*/ ); if( $dates ) { $archive_year = “”; foreach( $dates as $date ) { $the_date = strtotime( $date ); $year = date( ‘Y’, $the_date ); //4 digit year, ex 1999 $month = date( ‘F’, $the_date ); //Full textual month, … Read more

Query posts by Author and/or by Tag

Your first query is very strange. You seem to be mixing meta_query parameters with other WP_Query arguments. You can’t do that. author is not a valid component of a meta_query, neither is tag. The correct meta_query, if I am interpreting this right, wouldn’t even be a meta query. You are dealing with a taxonomy, a … Read more

Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months

First of all I don’t think you should use your custom query_posts in here. WordPress already queries posts on archive pages, so it’s waste of time to query them one more time. You should be using pre_get_posts filter. function my_pre_get_posts($query) { if (!is_admin() && is_main_query() ‘<YOUR_POST_TYPE>’ === $query->query_vars(‘post_type’) && $query->is_archive()) { $query->set(‘orderby’,’meta_value’); $query->set(‘meta_key’, ‘<YOUR_POST_TYPE>’); //formatted … Read more

Event with multiple dates, display events chronologically

Here you go, explanations as comments // setup array to store things in while we loop $events_out = array(); // assume you already have your loop built the way you want while($loop->have_posts()) : $loop->the_post(); $instances = array(); // grab meta dates $instances[] = get_post_meta($post->ID, ‘dateA’, true); $instances[] = get_post_meta($post->ID, ‘dateB’, true); $instances[] = get_post_meta($post->ID, ‘dateC’, … Read more

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