You can use get_posts()
for both event types and merge them.
$merged_events = array();
$upcoming = get_posts(array(
/* Your upcoming events args here. */
));
$past = get_posts(array(
/* Your past events args here. */
));
$merged_events = array_merge( $upcoming, $past);
foreach( $merged_events as $merged_event ) {
//Your loop
}
Related Posts:
- Meta query with string starting like pattern
- compare meta_query in get_posts arguments
- Getting attachments by meta value
- querying with custom meta field with meta_query
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- WordPress altering my custom query, How to fix it?
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Order by meta_key in custom post type doesn’t affect the query
- meta_key and meta_value not working together
- Order Posts by meta value AND published date
- How to make Meta Query case sensitive?
- Fetch Record based on meta key dates
- Meta_query with multiple keys and multiple values
- meta_query BETWEEN, but the range is stored in the custom field
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Large AND OR query timing out
- meta_value_num not ordering all items
- meta_compare not comparing whole integer
- Display posts with specific value first in query
- Get every post with value in meta key
- add_query_arg to compare and display events from a certain date
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- meta_query weird behaviour, static int will work, but not user data
- Query multiple post types, but different order for each
- Query ACF relationship field – Comparator IN – Value array
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- How do i create a custom post query when the meta value is an array?
- WP Query – grouping posts by same meta key, adding together values from another key
- meta_query is overriding default search
- Trouble with serialized metadata
- Comparing Meta Field date in WPQuery using Meta_Query?
- Getting posts by custom field value
- Query against multiple locations within single custom post type post
- WP_Query, ACF field and array
- Order by Date Custom Field
- Query by meta value (add a dropdown of all values)
- Order Posts By Custom Field That is an array of objects
- Custom WP_query and integrating into theme file
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Compare meta key separation
- query post based on comparison
- Get posts by meta value except one post [closed]
- WP Query Args – Title or Meta Value
- Can I query custom meta data through WP_Query
- Does tax_query really beats meta_query in all situations?
- Query WooCommerce orders where meta data does not exist
- Execute a large WP_Query with many “AND” Meta_Queries?
- Query all posts where meta value is empty
- WP_Query min and max values
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- How to query using a combination of custom_field values?
- Revolution Slider Orderby Two Custom Fields
- Meta-value query
- Meta query field order together with post_date order causes posts without the meta field to be unordered
- Display link to taxonomy archive only if it has posts with certain custom field values
- pre_get_posts filter meta_query without conflicting existing meta_query
- Undefined property: WP_Query::$post
- Programmatically set ‘meta_query’ for filter
- WP_Query meta_query >= date
- Extending woocommerce admin product search
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- WP_Query: include custom post type only with specific meta value
- Query multiple meta values
- Query by multiple meta elements not seeming to work – wordpress is timing out
- How does one perform a sub query with different post types
- Query posts without meta preload
- Query all posts if multiple meta key don’t exist
- wp_query to print posts if have X custom field value
- meta queries do ‘either/or’ checks
- WP Query ordering on a meta field for posts with a date in the future not ordering by datetime
- Selecting posts with a given meta value for a meta key
- How to order posts on each different category?
- get_page meta query not working, maybe a bug?
- Query by date from custom field
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Sort posts using multiple custom fields and menu_order in single query?
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- How to add a “base” filter for all posts visible to visitors on the site?
- meta_query with meta values as serialize arrays
- Multiple WP_Query args combinations according to post type
- WP_Query multiple value not working
- Unusual high query of user meta data
- How to create URL parameters to run custom queries?
- WP Query Meta Query
- Query custom meta value – post view and date meta
- How can I modify standard search query to include also ACF custom fields values?
- WP_Query – show posts where meta value and user_email match
- Best way to Order Post in Home without a plugin
- Loop through multiple custom fields with increasing number
- Return a single custom post from multiple meta queries
- new WP_query using custom fields
- Including ‘cat’ => $cat breaks meta_query
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- 294 Queries on Mainpage of WordPress
- WP Query – Show custom posts only if user contain some user meta
- How do I subquery with custom meta fields?
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string