This should do it.
// See if the post is older than 24 hours.
if ( get_post_time() <= strtotime( '-1 day' ) ) {
echo 'Published more than 24 hours ago.';
} else {
echo 'Published within the last 24 hours.';
}
Related Posts:
- How to schedule multiple posts while adding new
- order posts by date like craigslist
- Human Time Diff, change mins to minutes
- How to get the latest posting time of archived pages in WordPress?
- How to insert current date/time in the content of a post?
- How to get the date of a post in WordPress, so I could use it in a script?
- Automatically Updating Publish Date Bug
- How can I show many posts an author has per week?
- If modified on same day, show only time
- Update all comments time to random dates?
- Prevent scheduled post being published if date/time is past current date/time
- Automatically add date to the auto generation of post slug
- Calling Different Custom Post Timestamps in a table
- How i can limit period of post publication?
- Changing default WP-Site creation date
- tribe_get_start_time displays the current date and time on other post types than tribe_events
- Get the most recently modified post date of most recently modified post
- Date is wrong on ‘all posts’ page
- change the post time on multiple posts
- Access last visit time to a post
- Get timestamp of latest post in C#
- Post navigation using date
- Bulk update published posts date randomly using wp-cli?
- How do you update post date (year only) in a separate custom field?
- How to handle dates, trying to calculate time since a post
- date_query returning only the most recent post instead of the post published before today
- Should we trust the post globals?
- How to get the number of posts in a selected category?
- how to limit edit_form_after_title hook to page and post edit only?
- Add a checkbox to post screen that adds a class to the title
- How to cache a shortcode functions output?
- count number of posts (public , private , protected) by category name
- How to call function within a page/post, to dynamically generate content?
- Post Size Limit
- How to force update all posts after import
- Programmatically inserting page breaks
- How to have different content in the loop and single
- Make “Post published. View post” Open in a New Tab
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- How can I extract the URL of a link from a post?
- New posts defaulting to ‘0’ primary key
- Save list from a custom meta box?
- Same content shared between multiple posts?
- How to add in title a date but with other color, like in iMDb titles?
- Remove custom posts that match taxonomy value
- Link button is not working while editing a post in Firefox [closed]
- Post Type Label Name
- Disable author profile in post
- Limit Gutenberg blocks available to users to choose from
- Display a post by ID attribute with shortcode
- Retain select value in select box
- How to set up multiple taxonomies for groups of posts
- Update admin side post list count text
- How can I set a Post’s default visibility to private and pending review checked
- Blog Posts in Custom Menu
- How do I get blog posts to appear within CMS?
- Multisite: Can’t Post or Create Categories
- Query values from a Post Object Repeater [closed]
- limit to months rather than by number of posts
- Simultaneous admin updates causes custom fields to not update
- Using ajax on editing a category edit page?
- Do action on publish or update?
- How to get posts and comments amount per hour, per year and per month?
- Get Post’s first image using Short-code
- Delete post results in “Cannot delete or update a parent row: a foreign key constraint fails”
- Change all author links in Blog roll
- Let both the admin and post author update comment meta
- Modify posts listing at back end
- WordPress Query Posts From Category Post on Static Page
- How to allow multiple thumbnail upload for Posts?
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- Random posts that always include a particular post?
- How to remove text and retain in caption image using the_content function
- Different number of posts per row in grid layout
- Static pages not working
- How to add future Posts to the new “Internal Linking” Feature
- why my urdu text is not aligned properly when written in wordpress blog post?
- shortcode // get posts by ids
- get posts, run a custom query, and join the results
- Using AJAX to filter posts without refreshing page
- How to disable WordPress from automatically changing “x” to multiplication symbol “×” when typing numbers that also contain an “x” between them?
- Add class to global $post
- Multisite how to display merged posts from two sites and sort by latest date?
- Post relationships/nesting
- wp_insert_post not inserting post
- Grab meta data before post is saved
- Displaying dynamic content (blog posts/portfolio) on a static homepage and keep the blog post styles
- WordPress not showing recent posts
- How can I display a specific number of post in a category via a url
- How to display term in archive page?
- how to chang preview of list of articles of one category?
- Keep post format class with isotope filter
- WordPress is creating a lot of draft posts
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- Sort post by category using HTML Select tag
- How to add audio media in a post?
- First Custom Post Custom Fields Empty After New Custom Post
- what template-part to call, to have my post in the center of the page?
- How enter custom post meta or custom field on box post list archive page?
- How to allow Contributors to edit their own posts, whilst still needing to be reviewed by an admin?