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
- Sorting a query by custom field date
- Automatically fill custom field value on post publish/update
- How to sort a table of custom posts by column containing custom field
- 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
- Show ACF field from custom taxonomy and display on the single template
- Change message given when deleting post from custom post type
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- 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
- Link users to a custom post type
- Custom Post type and Custom Field WP_Query
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- get_posts of Custom Post Type AND Custom Taxonomy
- Retrieve value of a category’s custom field
- Replace text in post from cvs
- How can I dynamically add a post to a custom post type which uses a custom field?
- Query & Order posts by custom fields
- 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
- get_post_meta not working on publishing
- Query custom post type with ACF Date
- Using custom field content as expression in IF statement [closed]
- Meta Query Not Returning Output Despite Having Matching Values
- ACF From & To Date Validations
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- Order Custom Post Type by Custom Field Value
- How to update post meta on uploaded image from a custom form?
- Multiple Frontend Filters Using Advanced Custom Fields
- Integrate Custom Post Type Events into Calendar
- WebP Fallback for Inline Background Image in Style Attribute
- Query based on custom fields start and end date
- Redirect to another page using contact form 7? [closed]
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- How to get a custom type post data when it has a connection with another custom type post?
- List of users that clicked a ‘Join’ button at single post
- How to inherit field value from parent post into in child / sub post
- Get data from PHP to JavaScript to set position of each post on front page
- Query entries from custom post type in an ACF flexible content field
- posttype and custom fields on multisite
- How do I replace the post title with a custom field?
- Sum and count of custom field values
- Group by custom field value (start and end times)
- meta query not retrieving posts
- Incorrect ordering of custom post type based on time
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- 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
- Let users upload image(s) to the post from front end
- Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out
- How do I ensure that post_type and Taxonomy use the same slug?
- 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 fields array to display it monthly
- Custom front-end form for adding post – Category problem
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Sort custom post column by generated value?
- Display Custom Field or Custom Taxonomy in front page /post/product
- How to access repeater field of a custom field?
- Filter posts by their related field’s custom field
- How can I fetch all the dates from custom fields from various different custom post types and show / list them at one place in ascending order?
- filter using custom fields
- Autofill advanced custom field with user data
- Advanced search form with multiple custom fields
- PHP Notice: Unidentified index
- CPT: execute code after load if parameter is set
- Fixed custom fields depending on posttype/category
- 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?
- Custom post tag images not displaying with ACF
- Function not pulling image or text from custom post type
- 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
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Custom Post-type not returning the right child_of
- Select Menu for Custom post Type does not save
- How to show animal lineage/pedigree in WordPress?
- How do I filter a custom post type loop by a field?
- ACF – Query relationship without ID
- Getting ACF relationship field information
- How to I add count of custom posts listed in a post as a prefix to its title
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- 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:/