I’m not sure why you are comparing anything when you would normally just query a meta_key for a certain day, maybe I mis-understood the question.
The structure would be something like:
meta_key => day // or $variable
meta_value => Monday //for example
Then you just query posts for a particular day which has a meta field value that matches.
For example using pre_get_posts to alter your main query to only get posts where the value is equal to the actual day.
function wpse_78591_date( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$today = date("l");
$query->set('meta_key', 'day');
$query->set('meta_value', $today );
}
}
add_action( 'pre_get_posts', 'wpse_78591_date', 9999 );
or in your example it would be:
$args = array( 'post_type' => 'nightclub' , 'posts_per_page' => 10, 'key' => 'day' , 'value' => $today );
In my example I have hardcoded 'key' => 'day' but you can use a variable instead.
Related Posts:
- Can’t pick up a field created with Advanced Custom Fields
- Get month and day from a Date Picker custom field
- Search that will look in custom field, post title and post content
- Filtering a WP_Query meta_query by numeric values isn’t working
- Sorting a query by custom field date
- Automatically fill custom field value on post publish/update
- Filter a custom field based on selection of another custom field (ACF) [closed]
- ACF Relationships in Custom Post Type Permalink
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Meta Query “IN” doesn’t work with ACF checkbox filter
- List events by month
- Use Custom Post Type as Custom Field
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- WP insert post PHP function dynamically generated Custom Fields
- Show ACF field from custom taxonomy and display on the single template
- Change message given when deleting post from custom post type
- Display posts if a custom field value is equal to another custom field value
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Get Custom Field Values by Another Custom Field in WordPress
- How to Display ACF Relationship Custom Field as Link to Specific Custom Post?
- Query Custom Post Types by date (custom field) range
- Conditional to modify query results
- Create a random unique 6 digit number as custom field for custom post type
- Using several custom fields as custom post title
- Custom Post type and Custom Field WP_Query
- How to change post featured image using a custom field of category?
- Retrieve value of a category’s custom field
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Trash / Draft a WordPress custom post after custom date field expires
- Bulk Update Custom Fields for Custom Post Types
- Changing wordpress publication date to ACF date and time picker date not working
- WP_Query order by custom field, then randomly order some of results
- get_post_meta not working on publishing
- Query custom post type with ACF Date
- Meta Query Not Returning Output Despite Having Matching Values
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to render a custom post type template with custom fields using shortcode
- Order Custom Post Type by Custom Field Value
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Multiple Frontend Filters Using Advanced Custom Fields
- Integrate Custom Post Type Events into Calendar
- WebP Fallback for Inline Background Image in Style Attribute
- Add additional field to custom post_type
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Sort a custom post with ACF: Date Picker & Display Featured!
- How to inherit field value from parent post into in child / sub post
- finding and using post type fields in WordPress
- Custome fields not displayed
- Create short URL with auto 301 redirect
- Get data from PHP to JavaScript to set position of each post on front page
- posttype and custom fields on multisite
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- Sum and count of custom field values
- Group by custom field value (start and end times)
- Custom post types, disable fields
- meta query not retrieving posts
- Incorrect ordering of custom post type based on time
- How do I show my containing my custom field ONLY if there is a set value on that custom field? [closed]
- CPT Repeatable Fields + Undefined Index
- Excerpt length: get first paragraph
- How to create repeater field manually, without plugin (ACF Pro)?
- Fetch data from two custom post types and create multidimensional array for output to html table
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- ACF – Retrieve custom taxonomy from a relationship field
- Custom front-end form for adding post – Category problem
- count & sum the value of custom field of the author post in dynamic posts
- Alike Shortcode using in Custom Shortcode
- Grouping custom wordpress post types by acf value
- Query custom post type that has a serialized relational advanced custom field value
- Sort custom post column by generated value?
- WordPress – display relationship between blog posts and custom posts
- when looping through custom post data not appearing
- Custom sorting in post columns by ACF Pro Select Field
- Load info from customposttype into template page
- Filter posts by their related field’s custom field
- Autofill advanced custom field with user data
- Advanced search form with multiple custom fields
- PHP Notice: Unidentified index
- Display related post content and custom field content
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Automatically convert standard posts with custom fields to custom post types
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Show Custom Post Type taxonomy term that matches custom field
- using ACF datepicker to filter posts on a page
- Setting a custom $query->query_vars[‘meta_key’] breaks the WordPress menu
- Order by custom field attribute
- Custom Post-type not returning the right child_of
- Select Menu for Custom post Type does not save
- ACF – Query relationship without ID
- Retrieve a post with its ACF repeater fields in wordpress
- Send email on creation of custom post type and use get_post_meta()
- Display ACF object field data using Elementor Custom Query
- Post object GUID adding http:/
- Custom Sort Order for Custom Post Type Taxonomy
- Meta query with ACF relationship field
- How to automatically update ACF field value every year?