It took me less than a minute of asking the googles (or bing, or duck) to find this answer:
https://stackoverflow.com/questions/3454258/php-date-yesterday-today
The accepted answer has the code you want to use (or will give you a starting point).
(And this is not really a WordPress question…it’s a PHP question. PHP questions belong on the Stack Overflow place: https://stackoverflow.com/ )
Related Posts:
- Primary navigation menu with timed items from custom post type
- WordPress Ajax filter: Create two loops for different output styles?
- How to display sticky post always at the top (before regular post) in wordpress?
- adding or removing endforeach; throws error!
- Return to the beginning of the results of a for loop
- How to count posts posts if they are in a separate content page?
- Adding PHP to an if else loop
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- WordPress Recent Posts – Loop
- Can’t add to time? [closed]
- Exclude category and post from loop in custom category.php
- ACF background-color per post in a WordPress loop
- How can I get my pagination loop to display the correct number of total pages?
- Grouping posts by date
- Advertisement in Loop Posts wordpress
- How do if all posts has this category ID then do this
- Thumbnail wouldn’t scale to size properly
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- Date of last blog update for specific authors only?
- WordPress change post date format from english to japanese
- View tag description on page
- Making list of posts with chosen description
- Filter loop by ‘price’ with meta_query
- Get current_post in reverse order with pagination
- PHP for loop not working as intended
- How fix error in the WordPress loop?
- Comparing Dates within plugin using PHP If statement
- what’s the syntax for if the image exists get the image?
- Adding custom PHP to existing loop in Genesis
- How to Pass Current Taxonomy Terms into new WP_Query?
- Problems with the WordPress loop [closed]
- Add div after every 4 posts then every 2 posts for a responsive loop
- how to remove replicating a tag inside loop?
- My query keeps looping infinitely ! how to stop it?
- Efficient way of querying for a “fallback” post?
- Insert div after every three posts in home.php [duplicate]
- Adding a number to a date
- WordPress while loop with aphabetic counting like one, two, three
- Display product attributes for current product
- Retrieving specific images from Media Library
- For each 3 posts, show a different post type
- Div Missing In Custom Loop Query
- Add post class in custom loop (WP_QUERY)
- Loop 1 user randomly
- Create a hierarchical loop at predefined markup requirements
- Display Year and Month from custom field + Age Calculator
- enumerating custom taxonomies?
- Loop returns more items than exist?
- Using page template to fetch posts in page
- Modify category archive page loop on functions.php
- Custom Taxonomy Link Text Echo Name Not Slug
- WP_Post is not from correct array
- Post formating on Home page
- divide custom field values in div every two values
- Create Customization Controls from Array
- Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll
- I want my wordpress loop to only display posts of the standard format
- Automatically create a loop for post ID
- WP Knowledge Base Theme bug – Subcategories and Articles, Need to change WP_Query
- Limit ads appearing more than three times
- Problems With Query and/or Template Part and/or PHP
- Two loops in one function
- ACF loop and php formatting
- How to display thumbnail if post is assigned one otherwise not
- How to have post count after each listed category
- Inserting A Feed and Sidebar into an HTML Page
- How can I put a custom field as the link of a button shortcode?
- Pagination on Custom Loop
- Pagenav Not appearing on custom Template
- Error trying import one category on page
- What is the best way to get the first few post from WordPress in different divs using a loop?
- why is this content-template not showing any of my blog-entries?
- Transient Loop Not working as expected
- the_post_thumbnail unless video id is added
- Advanced Taxonomy query, with 3 post types
- Remove the_content From Loop
- Trying to display ads on only a third of posts in a loop. Keep getting Error 500?
- Custom Meta Box If Else Statement
- Custom single.php files for different post formats
- Adding if statement to content for homepage
- Tables not showing divs and loop/php items
- How to call the_author_meta and make it work?
- Troubleshooting “loopback requests that take too long”
- Why does a meta_query break this WP_Query?
- Conditional in foreach loop is outputting content twice
- WordPress post pagination on custom template not working
- Alternative loop syntax error [closed]
- Pagination in category.php not functioning
- is there away to hide php code in wordpress not to show in PAGES
- Implement “No related posts for this entry” into the loop?
- For each loop will not append to the_content hook
- Excerpt all post content Content Same Size without word cutting off
- How to handle parent and child pages?
- Options.php loop won’t show!
- Loop on a wordpress Page instead of content coming from the WP text editor
- How do I remove blog entries from home page Twenty Eleven child theme?
- How to create a loop where loop changes every post?
- How to create a loop that will display one post and stop?
- Woocommerce linking variations