you can use custom taxonomies and make you query_posts much easier!
by that i mean create a custom taxonomy for type,duration like so:
add_action('init','register_event_tax');
function register_event_tax(){
register_taxonomy('even_type',array('events'), array(
'hierarchical' => false,
'labels' => 'type',
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'type' ),
));
register_taxonomy('even_duration',array('events'), array(
'hierarchical' => false,
'labels' => 'type',
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'duration' ),
));
}
then you can query posts like this:
query_posts('post_type=Event&duration=DAILY&type=COMEDY&meta_key=Date&meta_compare=>=&meta_value=" . $todaysDate . "&orderby=meta_value&order=ASC');
and you can change the duration and type to filter what ever type or duration you want.
hope this helps.
Related Posts:
- what is the correct way to compare dates in a WP query_posts meta_query
- Using meta_query, how can i filter by a custom field and order by another one?
- Return all custom meta data for one custom post type
- Display Custom Post Type Fields
- How to hook get_terms() to only show count of posts that have custom meta
- order by meta_value serialized array
- Display custom post types with custom date field value (before today) & order by custom date field
- How to insert content from another Custom Post type into Post?
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Best way to create a search for custom post type by custom field values
- Incorrect ordering of custom post type based on time
- Display Posts Query with IF function
- WP query_posts group by meta field related
- Query Distinct Taxonomies of Custom Post Type
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Display ACF object field data using Elementor Custom Query
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Custom REST endpoints for a custom post type with custom fields
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- Hierarchy and access control for Custom Post Types (CPT)
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- First custom field value (out of several) displayed twice after query
- Meta Query posts not showing on ending date of custom field
- Query posts based on the meta key values of logged-in users?
- Cannot save CPT meta box
- Cross reference custom post types
- Adding Page Templates to post but it ignored it
- Include related custom fields from one post type in another post type’s JSON feed
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- frontend image post uploader
- Limit the post for differents custom post type in the same wp_query
- Is there any way to add a “custom field” to the CPT archive page?
- Different Ways to Query Custom Post Types?
- How to Output which matched meta_keys were found from custom_type_posts?
- Multiple Frontend Filters Using Advanced Custom Fields
- Custom Post Fields at the beginning of a Custom Permalink
- Integrate Custom Post Type Events into Calendar
- Possible to filter custom post type with multiple meta data?
- BBPress Search results in WordPress search
- Custom post type archive page for multiple post types
- Hierarchical custom fields
- How to get a custom field value of a custom post?
- Fields for different parts of a page
- Is it possible to activate customfield ‘text description’ upon activating the customfield ‘checkbox’?
- Facebook social publisher and custom post type fields [closed]
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Displaying custom field according to date
- Displaying and searching Custom Posts
- Importing Data from a Non-WordPress database, into WP
- custom comments form for custom post type
- Listing all term items alphabetically / sorting loop
- Searching Custom Fields
- Show fields based on taxonomy selection in editor
- filter search custom field query
- Permalinks: custom structure for taxonomy – tags?
- How to let users choose where to search for posts?
- don’t publish custom post type post if a meta data field isn’t valid
- WebP Fallback for Inline Background Image in Style Attribute
- pagination not working for category.php (custom post types in categories)
- Query based on custom fields start and end date
- How to add multiple markers on the google map, at a certain meta_key and meta_value
- How to display Related Posts based on number of taxonomy terms matched
- Custom fields for custom post type
- How can meta boxes be added to “unknown” custom posts?
- Custom “radio button meta box” not saving correctly
- It’s possible to hide body copy box for a custom post type?
- Can we create a custom post template for a specific page template
- Warning: Invalid argument supplied for foreach() [closed]
- Settings API – save multiple tabs at once
- Add additional field to custom post_type
- How to Get the title of a custom field?
- Custom Post Meta from custom metaboxes is randomly being deleted
- Check if post with same meta value exists
- Filter date from post meta when date is in string format
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- query_posts adding extra code to homepage
- How to show only the most recent post on my custom post type archive?
- Multiple single templates?
- Custom Field values not Showing in Edit Page of Custom Post Type
- How to make WP_Query not to show irrelevant posts?
- How can I add a custom field to an existing custom post type?
- Add a custom meta box for client to order CPT posts how they want
- Custom posts type for individual pages?
- Custom post type’s extra fields – how to handle?
- What is the ID parameter for custom post types in query_posts?
- Loop for custom post types filtered by a taxonomy
- custom post data – how to
- Send a conditional email notification when a custom field value changes in Post Type
- Enable Custom Fields For Custom Post Type When CPT Created Using Plugin
- Create custom post with meta field with AJAX and the WordPress REST API
- Specifying meta field’s column type in Database using add_post_meta
- How to get a custom type post data when it has a connection with another custom type post?
- Get Post Terms of Current Post (selected taxonomy term) – How to get only the taxonomy value and not “Array ( [0] => taxonomy term )” in the frontend?
- Add post meta programmatically to attachment
- WP Query ‘posts_per_page’
- Submitting Custom Post Types with custom fields from Front-end form
- Custom Post Type Metadata Not Saving
- How to create multiple editor?