You are not checking the current date correctly. You need to use current_time()
funciton to get current datetime according to WordPress configuration. Then, using PHP date()
you can check what day of week current date is:
// Get current date time of WordPress in Unix timestamp format
$timestamp = current_time( 'timestamp' );
// Get day of the week of current date
// See http://php.net/manual/es/function.date.php
$dw = date( "w", $timestamp);
// Check day of the week: 0 for Sunday to 6 for Saturday
if( $dw == 0 ) {
// Display content if day of the week is Sunday
}
Related Posts:
- How to sort CPT by custom meta value (date), and return posts month by month
- Meta Query posts not showing on ending date of custom field
- Sort custom post type by most current date picker
- Problem with date comparison for custom fields
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- Pre_get_posts comparison with custom field doesn’t work
- Get month and day from a Date Picker custom field
- How to get past and upcoming post by defining date in custom field?
- How to display custom post type ordered by a custom field date
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- How to display *block number* instead *date value* on WordPress posts?
- How do I set the default admin sort order for a custom post type to a custom column?
- How can I change the admin search posts fields?
- Development of a WordPress Search Plugin – Best Practices
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- WordPress 4.4+ : How to revision CPT + metadata
- WP_Query orderby custom field then post_date in one query
- Using Custom Fields in Custom Post Type URL
- Query custom post type by custom field
- Adding meta values to permalink
- How to get custom metabox image field?
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- How to select one major category (or custom taxonomy) for a custom post type?
- front end radio custom taxonomy with custom post type
- How to get source of custom meta image?
- Get post info inside modal window?
- Add Taxonomy Values Within a Custom Post Type RSS Feed
- delete custom post based on custom field date
- Displaying Meta Box Image
- Get_post_meta() won’t return value
- Display posts if a custom field value is equal to another custom field value
- Custom field default value with counter
- wp parse_query not working with custom meta value
- Custom Fields vs Separate Table
- Check if a specific custom field exists?
- WordPress Create Post from front-end
- Using several custom fields as custom post title
- Copy custom field value to post title
- Custom Post Type + 20k posts = blank/404 within Admin edit.php [duplicate]
- Display custom fields on post excerpt or teaser
- WP_Query orderby modified to include custom meta changes
- Calculate all custom field values in the post loop
- add custom field to custom post type
- Role scoping for contributors down to the field level
- Having unique constraints for custom fields in a custom post type
- Display custom fields from custom posts in RSS feed
- A better way to add a meta box to custom post types
- Rows with custom columns not well formatted after Quick Edit save
- How do I set all of a particular post meta to a value within the custom post type I’m in?
- Can we create a custom post template for a specific page template
- Settings API – save multiple tabs at once
- Send a conditional email notification when a custom field value changes in Post Type
- Add post meta programmatically to attachment
- How to create multiple editor?
- Display post from a date range from custom field
- List of users that clicked a ‘Join’ button at single post
- Get Specific Template Part if Custom Field is Some Value
- Targeting categories in custom fields
- How to make a pulldown menu display custom meta terms in a theme?
- search custom post type by custom fields on front end
- Change WordPress custom field default calendar [closed]
- How to copy a custom field from the user’s CPT to the user’s normal posts
- How do I update_post_meta() or add_post_meta() with an AJAX call
- Filtering Custom Post Type by Comparing Date and Two Meta Keys
- Automatically add a character to field in edit post page
- Change Post Meta via AJAX from the posts list table
- How to keep a record of changes to a custom field?
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Mandatory field in Custom post
- Update value inside array update_post_meta
- WP query_posts group by meta field related
- How to store the third party script with HTML code in the wordpress custom input field?
- How To Read Read Custom Post Type Data in Headless CMS Mode
- Filter custom post type admin list by custom meta column, where the column is another custom posts meta value
- How to upload an image to a custom post type
- Display post count for a specific month
- How to display custom field in product description?
- when looping through custom post data not appearing
- Add custom template ‘sub-page’ to Custom Post type?
- Where is get_post_meta value located?
- Confused about where to store my data
- Sort loop by custom field from different post type
- Meta_query by date for Events archive
- WordPress loop, show only one post per custom field
- one get_posts to return a number of custom posts for each meta value
- Is it possible to make one of two custom fields in Custom Post Type UI Required but not the other?
- Custom Post Type as invoice or order template
- WP_Query get posts where post_name is empty
- Get result from Custom Field in Custom Post type
- Make each Value of custom field show related posts when clicked
- Filter CPT based on meta box value using Flexible Posts widget?
- Querying meta values within an array
- Creating entries with image attachements within posts and managing them in a list
- How to Create a Frontend Html-list Editable in the Backend?
- Filter Custom post type by another Custom post type
- How to get lowest price from custom fields of posts
- Retrieve a post with its ACF repeater fields in wordpress
- Display ACF object field data using Elementor Custom Query
- How to consume external API from WordPress post editor and display the response data in the custom field?