the best way
If you input the gig time as a unix timestamp (using strtotime()), then you can use WP_Query‘s meta_value_num in the orderby element to set the order. You can also use WP_Query‘s meta_query to only get posts that have a date that occur in the future.
the other way
If you can’t do this for some reason or another (probably that your date is already set), if you get all the gigs, you can reorder the array of posts based on a strtotime() of your meta value. This will be a heavier implementation performance wise, so go with the other one if possible.
Related Posts:
- Query all posts where a meta key does not exist
- what is the correct way to compare dates in a WP query_posts meta_query
- Get post with multiple meta keys and value
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Echo all meta keys of a custom-post TYPE
- How can I filter posts by post_parent in the admin?
- Post metadata deletes itself
- Detect meta value changes when post is updated (post_updated)
- Custom Post Type: Set post_title equal to a custom post type field
- I can’t set meta_key in my custom post type query
- Compare 3 custom fields and sort by oldest
- How can I include meta box content when searching?
- update a post meta from a single table cell TablePress
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Automatically adding meta data to posts or multiple query help
- Trigger “unsaved changes” dialog for custom post meta changes
- Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
- Displaying custom posts only if custom meta box’s date is not expired
- Displaying Metabox value (custom post type taxonomy)
- How do I sort a custom post type admin column using two meta keys?
- How can I display my custom metaboxes on a custom post template?
- get_post_meta is returning image id
- Custom Post Type, Saving Multiple Checkboxes
- Create a random unique 6 digit number as custom field for custom post type
- Export entries and multiple custom field meta to .csv?
- how to interconnect custom post types?
- Metadata for a taxonomy – is there any WordPress way of doing this?
- orderby in custom WP Query does not work
- Update CPT post meta with update_post_meta and cron job
- Insert post metadata for all posts in CPT at once if metadata no existent
- Display custom post type from dynamic custom field
- Populate dropdown from one custom post type inside another custom post type
- Notice: Undefined index: error and understanding wordpress
- Custom Post Types. Are there any disadvantages/advantages in using a plugin to develop them?
- Get posts between custom dates
- Deleting Custom Posts & Meta Data on Uninstall
- How do I create an archive page as a including metadata?
- Two Custom Post Types Many to Many Relationship
- how can I register a post_meta field in an existing CPT and then call it again with get_post_custom()?
- post meta parameter in post custom-post-type endpoint with restapi
- Update postmeta Parent when post_status child change
- Update database from Quick Edit according to Checkbox state of Custom Post Type
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- Dynamic Custom Fields
- Show Custom Post Type meta boxes only on Page Edit
- Custom filter function not working with Custom post type
- Custom fields for custom post type
- Is there a way to exclude posts based on meta_values?
- Submitting Custom Post Types with custom fields from Front-end form
- create custom meta box with default value
- How to Echo Metadata Value in Currency Format
- Filter posts by tax (dropdown) and meta value
- Publish and save specific postmeta to a filtered post_type
- WP API Response does not show my registered metadata
- Batch Extract Date from post title and put into ACF custom field
- How to handle this specific case of custom post type?
- Save CTP post meta different values each day without overwriting previous values
- get_post_meta returns NULL in front-end, but correct result in back-end
- Problem with adding custom post type meta to header by plugin
- Meta box data is saved but NOT displayed in the meta box text field. Why?
- Echo custom post meta from options array
- Value of post meta dropdown is not showing in WordPress
- Sanitaizing Select Optin For Custom Post Type Metabox in WP
- HM CMB: Post Select Field for CPT ID
- Getting WordPress to store 0 values for custom post type meta
- Problem Saving Custom Post Type Meta Values
- Custom fields for post or terms which don’t update on post update
- Should I use a custom taxonomy or custom post type for grouping a list of panels associated with a group of tests?
- How to use multiple Meta Field from CPT as Post permalink
- Show posts from WP Custom Post Type selected from a field in a metabox
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Peepso: Add extra data field (custom post meta) to postbox
- Change picture attachment meta of all occurrences of a picture
- Unknown Post Meta Records
- Get Previous Post based on Custom Field Name, for Custom Post Type
- Saving custom post types post_meta over REST-API fails
- add action save post type and update post meta woocommerce
- get_post_meta not working with variable as a post_id for dynamically get the postid
- How to get post detail based on URL of the post
- Linking posts together with Advanced Custom Fields “both ways”
- Add more custom fields when creating a new custom post type
- Stripe multiple transactions
- Edit is changing my custom’s post type parent id
- Disable Facebook Comments Automatically On CPT
- How to add post reference field to a plugin?
- Problem with ‘save_post’ hook not running
- WordPress custom post type
- Edit post meta direct from post.php?
- Howto: use existing post_meta as options for a different metabox (checkboxes or list)
- Timetable of Custom Meta Data using Custom Post Type and Custom Taxonomy
- Change the contents of a dropdown through the admin panel?
- Top 30 Songs using Custom Post Type
- Advice Needed for Post Meta Database Efficiency
- fetch meta fields inside a widget
- Custom post type – update_meta not working
- Use a Variable in update_post_meta as the $meta_key
- Update an existing post in a custom post type
- Post Meta for Custom Post Types
- getEntityRecords/useEntityRecords: How to use CPT metadata?