Build or add to a query in WordPress

Get your queried vars from the original query.
http://codex.wordpress.org/Function_Reference/WP_Query
$query or $query_vars

Merge that with your own array, then pass that array into query_posts.

Try this for the args array.

	$args = array(
		'meta_key' => 'end_date',
		'meta_compare' => '>',
		'meta_value' => $my_now,
		'orderby' => 'start_date',
		'order' => 'desc',
		'showposts' => '99'
	);
	$args = array_merge( $args , array_filter( $wp_query->query_vars ) );

The array_filter removes any empty/false/null values from the query_vars array when merging..

Revisions

There are no revisions for this post.

No comments yet.

Leave a Reply