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
- What might cause two dates to appear on a blog post?
- Get WordPress post content by post id
- Get page ID of page that is set as the posts page
- Get Posts Under Custom Taxonomy
- How to limit the number of posts that WP_Query gets?
- Stop WordPress Wrapping Images In A “P” Tag
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Turn a URL into an Attachment / Post ID
- GET the excerpt by ID
- Stop WordPress automatically adding tags to post content
- Determine if page is the Posts Page
- How to get ‘post_content’ without stripping tags?
- How to add an admin notice upon post save/update
- Print Current Post Index number within Loop
- Should we trust the post globals?
- Optimize post insert and delete for bulk operations?
- Get the Current Page Number
- How do you add thumbnail support for custom post types?
- How to mark every 3rd post
- Change Posts per page count
- Keep featured content post in homepage with original order
- How to display related posts from same category?
- Can posts have parents?
- Is there a action hook for the “Empty Trash” button?
- How to end the excerpt with a sentence rather than a word?
- How do I check if I linked to a post before I delete it?
- How to change the case of all post titles to “Title Case”
- Appending content with broken in 4.4
- How to get posts published between a date and today?
- ZIP up all images displayed in a [gallery] and offer as download link
- How to detect single.php (but not single-portfolio.php)?
- How to check if post meta key exists or not in wordpress database
- How to remove a column from the Posts page
- removing inline styles from wp-caption div
- What is the use of to_ping and pinged column?
- How to use “Add link” pop up for a WordPress widget
- Remove Categories / Tags From Admin Menu
- How to retrieve text only from wp_content() not from wp_excerpt()?
- Stop WP from creating “Sample Page” and “Hello World!” post
- Where is the old post permalink slug stored?
- How to Create Editable Blocks of Text for the Homepage?
- Keyboard shortcut for updating a page or post?
- Add custom Attachment Display Setting for images
- Rewriting post slug before post save
- Apply the_title() filter in post & page title, but not in menu title
- How to Change Order of Posts in Admin?
- is it possible to get next_post_link
- Get post content by ID
- How to get post creation date?
- Update post counts (published, draft, unattached) in admin interface
- Function to execute when a post is moved to trash .
- How to get post ID of the current page/post inside a widget?
- add action only on post publish – not update
- How to display by default only published posts/pages in the admin area?
- How do you add Read more … link to posts?
- How to make comments work for a post loaded per Ajax?
- Is there an if statement that can determine if a post in the loop is the last post?
- Get current menu_order
- How to show related posts by category
- Changing the post date and time with function
- simply loop through posts
- Difference between an archive and a page listing posts
- Delete Associated Media Upon Page Deletion
- Set Default Listing “View” in Admin
- Access post from post id in URL
- Count posts within a custom post type and specific taxonomy and terms?
- How to add category to: ‘wp-admin/post-new.php’?
- Post preview mechanism architecture
- How to prevent posts from being published too close to each other?
- Passing current cookies in wp_remote_get to get Draft Post Preview
- How to hide specific Gutenberg blocks settings from users
- Post featured image column on admin post list page
- How to Display a List of Users Who Have Made at Least 1 Post?
- The next_posts_link() works only with original $wp_query